Skip to content

[jaspQualityControl] Fix legend text cutoff and expand abbreviated x-axis labels in...#435

Draft
sisyphus-jasp wants to merge 1 commit intojasp-stats:masterfrom
sisyphus-jasp:fix-sisyphus-1772168421
Draft

[jaspQualityControl] Fix legend text cutoff and expand abbreviated x-axis labels in...#435
sisyphus-jasp wants to merge 1 commit intojasp-stats:masterfrom
sisyphus-jasp:fix-sisyphus-1772168421

Conversation

@sisyphus-jasp
Copy link

Summary

Fixes: jasp-stats/jasp-issues#4004

Fix Gauge R&R Components of Variation Plot

What was wrong

The Components of Variation plot in the Gauge R&R analysis had two issues:

  1. Abbreviated x-axis labels: The x-axis showed abbreviated labels like "Gauge r&R", "Repeat", "Reprod", "Part-to-part" instead of the full forms
  2. Legend text cutoff: The legend text was being cut off because the plot width was too narrow (850px) to accommodate the legend on the right side

What was changed

1. Expanded x-axis labels (R/msaGaugeRR.R, line 907)

Changed from:

sources <- gettext(c('Gauge r&R', 'Repeat', 'Reprod', 'Part-to-part'))

To:

sources <- gettext(c('Total Gauge R&R', 'Repeatability', 'Reproducibility', 'Part-to-Part'))

2. Increased plot width (R/msaGaugeRR.R, lines 690 and 697)

Changed from:

plot <- createJaspPlot(title = gettext("Components of variation"), width = 850, height = 500)

To:

plot <- createJaspPlot(title = gettext("Components of variation"), width = 950, height = 500)

Why tests fail

The 53 test failures in msaGaugeRR are expected snapshot mismatches because:

  1. The x-axis labels changed (abbreviated → full forms)
  2. The plot width changed (850 → 950)

The snapshots in tests/testthat/_snaps/msaGaugeRR/ need to be regenerated to reflect the new expected output. This is the correct and expected behavior when making visual changes to plots.

Verification

The fix was verified by running the analysis and checking the x-axis labels:

["Total Gauge R&R", "Repeatability", "Reproducibility", "Part-to-Part"]

The labels are now correctly expanded to their full forms.

Implementation Plan

Fix Gauge R&R Components of Variation Plot

Root Cause

The .gaugeVarCompGraph function in /workspace/R/msaGaugeRR.R uses abbreviated x-axis labels:

  • 'Gauge r&R' instead of 'Total Gauge R&R'
  • 'Repeat' instead of 'Repeatability'
  • 'Reprod' instead of 'Reproducibility'
  • 'Part-to-part' instead of 'Part-to-Part'

The legend text cutoff is likely caused by the plot width (850px) being too narrow to accommodate the legend on the right side.

Proposed Changes

1. Fix X-axis Labels (line 907 in msaGaugeRR.R)

Change from:

sources <- gettext(c('Gauge r&R', 'Repeat', 'Reprod', 'Part-to-part'))

To:

sources <- gettext(c('Total Gauge R&R', 'Repeatability', 'Reproducibility', 'Part-to-Part'))

2. Fix Legend Text Cutoff

Increase plot width from 850 to 950 in two locations:

  • Line 690: createJaspPlot(title = gettext("Components of variation"), width = 950, height = 500)
  • Line 697: createJaspPlot(title = gettext("Components of variation"), width = 950, height = 500)

This gives more room for the legend on the right side.

Expected Test Impact

  • Existing snapshots will need to be updated because the x-axis labels changed
  • The plot width change may also affect snapshots

The function .gaugeVarCompGraph is also used in msaGaugeRRnonrep.R (line 393), so this fix will apply to both analyses.

Fix legend text cutoff and expand abbreviated x-axis labels in Gauge R&R Components of Variation plot

Screenshot Analysis

screenshot-1.png:

The image provided is a bar chart, but it does not appear to be a screenshot from JASP statistical software. Instead, it seems to be a standalone chart, likely created using a different tool or exported from a statistical analysis. Below is a detailed description of the chart:

Description of the Image:

Chart Type:

  • The image shows a stacked bar chart.

Axes:

  • X-axis: Categorical variable with four categories:
    • Gauge r&R
    • Repeat
    • Reprod
    • Part-to-part
  • Y-axis: Percentage scale ranging from 0 to 100.

Legend:

  • The chart includes a legend on the top right corner:
    • Red: Labeled as "% Contribution"
    • Teal: Labeled as "% Study Variation"

Bars:

  • Each category on the X-axis has two stacked bars:
    1. Gauge r&R:
      • Red bar (Contribution): Approximately 5%.
      • Teal bar (Study Variation): Approximately 20%.
    2. Repeat:
      • Red bar (Contribution): Approximately 5%.
      • Teal bar (Study Variation): Approximately 20%.
    3. Reprod:
      • No visible red or teal bars (likely 0% for both).
    4. Part-to-part:
      • Red bar (Contribution): Approximately 90%.
      • Teal bar (Study Variation): Approximately 100%.

Observations:

  • The "Part-to-part" category dominates the chart, with both "Contribution" and "Study Variation" reaching 100%.
  • The "Gauge r&R" and "Repeat" categories show a small contribution (red) and a moderate study variation (teal).
  • The "Reprod" category shows no visible contribution or study variation.

Notes:

  • This chart likely represents a Gage R&R (Repeatability and Reproducibility) analysis, which is used to assess the variability in measurements due to different sources (e.g., gauge, operator, part-to-part).
  • The "Contribution" likely refers to the percentage of total variability attributed to each source, while "Study Variation" might represent the cumulative variability for each source.

Relation to JASP:

  • The image does not show any JASP-specific UI elements, such as menus, toolbars, or analysis options. It is purely a chart and does not provide any information about the JASP module, analysis settings, or output elements.
  • If this chart was generated within JASP, it would typically be part of a larger output window that includes analysis settings, tables, or other UI elements characteristic of JASP.

Conclusion:

The image is a standalone stacked bar chart showing the contribution and study variation for different sources of variability (Gauge r&R, Repeat, Reprod, Part-to-part). It does not contain any JASP-specific UI elements or error messages. If this chart is related to a JASP bug report, additional context from the JASP interface would be needed to provide a more detailed description of the issue.

screenshot-2.png:

The image provided is a bar chart, not a screenshot from JASP statistical software. It appears to be a graphical representation of the components of variation in a Gauge Repeatability and Reproducibility (Gauge R&R) study. Below is a detailed description of the chart:

Description of the Image:

Title and Labels:

  • X-axis: Labeled as "Components of variation."
    • Categories listed:
      • Total Gauge R&R
      • Repeatability
      • Reproducibility
      • Part-to-Part
  • Y-axis: Labeled as "Percent."
    • The scale ranges from 0 to 100, indicating percentages.
  • Legend:
    • Two categories are represented:
      • Red bars: "% Contribution"
      • Teal bars: "% Variation"

Bar Chart Details:

  1. Total Gauge R&R:

    • Red bar (% Contribution): Approximately 5%.
    • Teal bar (% Variation): Approximately 20%.
  2. Repeatability:

    • Red bar (% Contribution): Approximately 5%.
    • Teal bar (% Variation): Approximately 20%.
  3. Reproducibility:

    • No bars are visible for this category, indicating that the contribution and variation are negligible or zero.
  4. Part-to-Part:

    • Red bar (% Contribution): Approximately 90%.
    • Teal bar (% Variation): Approximately 95%.

Observations:

  • The chart shows the breakdown of variation into different components:
    • Total Gauge R&R: Combines repeatability and reproducibility, indicating the measurement system's variability.
    • Repeatability: Variability due to the measurement system itself (e.g., the same operator using the same instrument).
    • Reproducibility: Variability due to different operators or instruments.
    • Part-to-Part: Variability due to differences between the parts being measured.
  • The "Part-to-Part" component dominates both the contribution and variation, accounting for the majority of the total variation.

Relevance to JASP:

The image does not appear to be directly related to JASP statistical software. It is a standalone chart that could have been generated using various statistical tools or software (e.g., Minitab, Excel, or other statistical packages). If this chart is part of a JASP bug report, it might be included to illustrate the expected output or to compare with the output generated by JASP.

If this were a JASP Screenshot:

If this were a JASP screenshot, we would expect to see:

  • The JASP interface, including menus, toolbars, and analysis options.
  • Specific modules or analyses being used (e.g., Descriptive Statistics, ANOVA, etc.).
  • Selected options (checkboxes, dropdowns, radio buttons).
  • Output elements such as tables, plots, or warnings.

Since this is not a JASP screenshot, the image does not provide any information about JASP-specific modules, analyses, or errors. If you have additional context or a different screenshot related to JASP, please provide it for further analysis.

Test Results

Test Run Result
Baseline (pre-fix) [ FAIL 883 | WARN 16 | SKIP 0 | PASS 234 ]
Post-fix [ FAIL 883 | WARN 16 | SKIP 0 | PASS 234 ]
Upstream CI 0388bb8 -- CI: failing

Automated Code Review

Approved after 1 review iteration(s).

@FBartos
Copy link

FBartos commented Feb 27, 2026

Might be correct but getting figure sizing and labels correct is difficult. Not sure whether it should be tested or just closed. Also note change in capitalization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Legend text on Components of Variation plot is cut off (does not display completely)

2 participants