Skip to content

feat(pygal): implement sn-curve-basic#3863

Merged
github-actions[bot] merged 10 commits intomainfrom
implementation/sn-curve-basic/pygal
Jan 15, 2026
Merged

feat(pygal): implement sn-curve-basic#3863
github-actions[bot] merged 10 commits intomainfrom
implementation/sn-curve-basic/pygal

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Implementation: sn-curve-basic - pygal

Implements the pygal version of sn-curve-basic.

File: plots/sn-curve-basic/implementations/pygal.py

Parent Issue: #3826


🤖 impl-generate workflow

github-actions Bot and others added 2 commits January 15, 2026 21:42
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Jan 15, 2026

AI Review - Attempt 1/3

Image Description

The plot displays an S-N curve (Wöhler curve) for steel fatigue testing data. Blue circular markers represent test data points scattered across the plot, showing the characteristic inverse relationship between stress amplitude and cycles to failure. The x-axis shows "Cycles to Failure (N)" on a logarithmic scale ranging from 100 to 10,000,000, with labels displayed as plain numbers (100, 1000, 10000, etc.). The y-axis shows "Stress Amplitude (MPa)" ranging from approximately 150 to 550 MPa. Three horizontal reference lines are present: a red line at 520 MPa (Ultimate Strength), a green line at 350 MPa (Yield Strength), and a purple line at 190 MPa (Endurance Limit). The legend is positioned at the bottom, showing all four series with colored squares. The title "sn-curve-basic · pygal · pyplots.ai" appears at the top. The plot has a white background with subtle vertical grid lines.

Quality Score: 85/100

Criteria Checklist

Visual Quality (32/40)

  • VQ-01: Text Legibility (8/10) - Title and axis labels are readable but tick labels are somewhat small for the canvas size
  • VQ-02: No Overlap (8/8) - No overlapping text elements
  • VQ-03: Element Visibility (6/8) - Markers are visible but could be slightly larger given the data density (~40 points)
  • VQ-04: Color Accessibility (5/5) - Good color choices: blue for data, red/green/purple for reference lines are distinguishable
  • VQ-05: Layout Balance (3/5) - Plot area is well utilized but the bottom legend creates some empty space
  • VQ-06: Axis Labels (2/2) - Descriptive labels with units: "Stress Amplitude (MPa)", "Cycles to Failure (N)"
  • VQ-07: Grid & Legend (0/2) - X-axis labels show plain numbers (100, 1000, etc.) instead of the intended superscript format (10², 10³, etc.) which the code attempted to implement

Spec Compliance (22/25)

  • SC-01: Plot Type (8/8) - Correct XY scatter plot for S-N curve
  • SC-02: Data Mapping (5/5) - Cycles on x-axis (log scale), stress on y-axis correctly mapped
  • SC-03: Required Features (4/5) - Has reference lines for Ultimate, Yield, and Endurance Limit; missing the fitted curve/Basquin equation line mentioned in spec
  • SC-04: Data Range (3/3) - Axes show all data points appropriately
  • SC-05: Legend Accuracy (2/2) - Legend labels are accurate with MPa values included
  • SC-06: Title Format (0/2) - Title format is correct: "sn-curve-basic · pygal · pyplots.ai" ✓ (correction: 2/2)

Data Quality (18/20)

  • DQ-01: Feature Coverage (7/8) - Shows scatter from multiple specimens per stress level, covers low-cycle to high-cycle fatigue regions
  • DQ-02: Realistic Context (7/7) - Steel fatigue testing is a real engineering scenario with appropriate material property values
  • DQ-03: Appropriate Scale (4/5) - Values are realistic (stress 190-520 MPa, cycles 10²-10⁷), though the lack of visible data below endurance limit is expected

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) - Simple linear structure: imports → data → chart creation → save
  • CQ-02: Reproducibility (3/3) - Uses np.random.seed(42)
  • CQ-03: Clean Imports (2/2) - Only necessary imports: numpy, pygal, Style
  • CQ-04: No Deprecated API (1/1) - Uses current pygal API
  • CQ-05: Output Correct (1/1) - Saves as plot.png and plot.html

Library Features (3/5)

  • LF-01: Uses Distinctive Features (3/5) - Uses pygal Style customization, XY chart with logarithmic scale, custom x_label_formatter (though not rendering correctly), legend_at_bottom

Strengths

  • Excellent data generation with realistic fatigue test scatter using Basquin relationship
  • Clean code structure following KISS principles with proper seed for reproducibility
  • Good use of pygal Style for customizing colors, fonts, and sizing for the large canvas
  • All three material reference lines (Ultimate, Yield, Endurance Limit) with clear legend labels including MPa values
  • Proper logarithmic x-axis for the wide range of cycle counts

Weaknesses

  • X-axis tick labels display as plain numbers (100, 1000, 10000) rather than scientific notation or superscript format - the custom x_label_formatter using Unicode superscripts is not rendering as intended
  • Missing the fitted S-N curve (Basquin equation line) overlay mentioned in the specification notes
  • Markers could be slightly larger (dots_size=14) given the moderate data density for better visibility

Verdict: REJECTED

@github-actions github-actions Bot added quality:85 Quality score 85/100 ai-rejected Quality not OK, triggers update labels Jan 15, 2026
@github-actions github-actions Bot added ai-attempt-1 First repair attempt and removed ai-rejected Quality not OK, triggers update labels Jan 15, 2026
Attempt 1/3 - fixes based on AI review
@github-actions
Copy link
Copy Markdown
Contributor Author

🔧 Repair Attempt 1/3

Applied fixes based on AI review feedback.

Status: Repair completed, re-triggering review...


🤖 impl-repair

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Jan 15, 2026

AI Review - Attempt 2/3

Image Description

The plot displays an S-N curve (Wöhler curve) for steel fatigue testing on a 4800×2700 canvas. Blue circular markers represent test data points showing the characteristic inverse relationship between stress amplitude and cycles to failure. Three horizontal reference lines span the plot: red at 520 MPa (Ultimate Strength), green at 350 MPa (Yield Strength), and purple at 190 MPa (Endurance Limit). The x-axis uses a logarithmic scale from 100 to 10,000,000 cycles with numeric labels. The y-axis shows Stress Amplitude in MPa from approximately 180 to 520. The legend is positioned at the bottom with colored squares identifying each series. The title correctly follows the format "sn-curve-basic · pygal · pyplots.ai". Grid lines are subtle and visible. Critical issue: The Basquin Fit (S-N Curve) line that should be overlaid on the data is NOT visible in the plot, despite being added in the code.

Quality Score: 75/100

Criteria Checklist

Visual Quality (32/40)

  • VQ-01: Text Legibility (8/10) - Title and axis labels readable, but font sizes could be larger for the canvas
  • VQ-02: No Overlap (8/8) - No overlapping text elements
  • VQ-03: Element Visibility (6/8) - Data points are visible with good size, but the Basquin fit line is missing/invisible
  • VQ-04: Color Accessibility (5/5) - Good color distinction between series (blue, red, green, purple)
  • VQ-05: Layout Balance (3/5) - Plot uses canvas well but legend takes significant space at bottom
  • VQ-06: Axis Labels (2/2) - Descriptive labels with units: "Cycles to Failure (N)", "Stress Amplitude (MPa)"
  • VQ-07: Grid & Legend (0/2) - Legend missing the Basquin Fit entry that should be visible

Spec Compliance (18/25)

  • SC-01: Plot Type (8/8) - Correct XY scatter plot for S-N curve
  • SC-02: Data Mapping (5/5) - Cycles on X (log), stress on Y correctly assigned
  • SC-03: Required Features (2/5) - Missing visible Basquin/power-law fit line (spec requires it)
  • SC-04: Data Range (3/3) - All data visible within axes range
  • SC-05: Legend Accuracy (0/2) - Legend shows only 4 series but code adds 5 (Basquin Fit missing)
  • SC-06: Title Format (2/2) - Correct format "sn-curve-basic · pygal · pyplots.ai"

Data Quality (18/20)

  • DQ-01: Feature Coverage (7/8) - Shows scatter at multiple stress levels, reference lines, but missing the fitted curve
  • DQ-02: Realistic Context (7/7) - Realistic steel fatigue test scenario with appropriate material properties
  • DQ-03: Appropriate Scale (4/5) - Values are realistic for steel (450 MPa high stress, 190 MPa endurance limit)

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) - Clean imports → data → plot → save structure
  • CQ-02: Reproducibility (3/3) - np.random.seed(42) used
  • CQ-03: Clean Imports (2/2) - Only numpy, pygal, and Style imported
  • CQ-04: No Deprecated API (1/1) - Current pygal API used
  • CQ-05: Output Correct (1/1) - Saves as plot.png and plot.html

Library Features (3/5)

  • LF-01: Uses distinctive library features (3/5) - Uses pygal XY chart with logarithmic scale, custom Style, but the stroke=True for fit line appears not to render

Strengths

  • Clean code structure following KISS principles with proper Basquin equation fitting
  • Realistic fatigue test data with appropriate scatter from multiple specimens per stress level
  • All three reference lines (Ultimate, Yield, Endurance) are clearly visible with labeled legend entries
  • Good use of pygal's custom Style for large canvas sizing
  • Proper logarithmic x-axis for the wide cycle range

Weaknesses

  • The Basquin Fit (S-N Curve) line is not visible in the rendered plot despite being added in the code - this is a critical spec requirement
  • The custom x_labels with superscript notation (10², 10³) are not displayed; regular numbers appear instead
  • Legend at bottom is missing the Basquin Fit entry, indicating the series may not be rendering properly

Verdict: REJECTED

@github-actions github-actions Bot added quality:75 Quality score 75/100 ai-rejected Quality not OK, triggers update labels Jan 15, 2026
@github-actions github-actions Bot added ai-attempt-2 Second repair attempt and removed ai-rejected Quality not OK, triggers update labels Jan 15, 2026
Attempt 2/3 - fixes based on AI review
@github-actions
Copy link
Copy Markdown
Contributor Author

🔧 Repair Attempt 2/3

Applied fixes based on AI review feedback.

Status: Repair completed, re-triggering review...


🤖 impl-repair

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Jan 15, 2026

AI Review - Attempt 3/3

Image Description

The plot displays an S-N curve (Wöhler curve) for steel fatigue testing with orange/red circular data points scattered across multiple stress levels (450 MPa down to ~195 MPa). A blue dashed line represents the Basquin power-law fit descending from upper-left to lower-right. Three horizontal reference lines are shown: red at 520 MPa (Ultimate Strength), green at 350 MPa (Yield Strength), and purple at 190 MPa (Endurance Limit). The X-axis shows "Cycles to Failure (N)" with a logarithmic scale spanning from ~100 to 10^7 cycles. The Y-axis shows "Stress Amplitude (MPa)" ranging from ~150 to 550. The legend at bottom lists all five series. The title correctly shows "sn-curve-basic · pygal · pyplots.ai".

Quality Score: 77/100

Criteria Checklist

Visual Quality (31/40)

  • VQ-01: Text Legibility (8/10) - Title and axis labels are clearly readable. Y-axis tick labels are good. However, some x-axis tick labels at higher values appear compressed.
  • VQ-02: No Overlap (5/8) - X-axis tick labels overlap/compress at higher cycle counts, appearing as "4000...600080001000..." instead of clean logarithmic labels.
  • VQ-03: Element Visibility (8/8) - Data points are well-sized (dots_size=20), clearly visible, and the dashed fit line stands out nicely against the markers.
  • VQ-04: Color Accessibility (5/5) - Colors are distinct and colorblind-safe: blue dashed line, orange data points, red/green/purple reference lines.
  • VQ-05: Layout Balance (3/5) - Layout is reasonable but the plot area is somewhat compressed. Legend at bottom works well but could be better positioned.
  • VQ-06: Axis Labels (2/2) - Both axes have descriptive labels with units: "Cycles to Failure (N)" and "Stress Amplitude (MPa)".
  • VQ-07: Grid & Legend (0/2) - Grid is subtle which is good, but the legend layout could be improved (series order not intuitive).

Spec Compliance (23/25)

  • SC-01: Plot Type (8/8) - Correct XY scatter with logarithmic x-axis showing S-N fatigue data.
  • SC-02: Data Mapping (5/5) - Cycles (N) correctly on x-axis, stress amplitude on y-axis.
  • SC-03: Required Features (5/5) - All spec features present: log scale on x-axis, Basquin fit curve, reference lines for Ultimate Strength, Yield Strength, and Endurance Limit, multiple test specimens with scatter.
  • SC-04: Data Range (3/3) - Full range of data visible from 10^2 to 10^7 cycles, stress from 150-550 MPa.
  • SC-05: Legend Accuracy (0/2) - Legend labels are correct but order could be more logical (data first, then fit, then reference lines).
  • SC-06: Title Format (2/2) - Correct format: "sn-curve-basic · pygal · pyplots.ai".

Data Quality (18/20)

  • DQ-01: Feature Coverage (7/8) - Shows low-cycle to high-cycle fatigue transition, scatter from multiple specimens, and Basquin fit. Could show clearer distinction of the three fatigue regions.
  • DQ-02: Realistic Context (7/7) - Steel fatigue testing is a real engineering scenario with realistic stress values (190-520 MPa range typical for steel).
  • DQ-03: Appropriate Scale (4/5) - Values are realistic for steel: UTS ~520 MPa, YS ~350 MPa, endurance limit ~190 MPa. Cycles to failure range 10^2 to 10^7 is appropriate.

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) - Clean structure: imports → data generation → chart configuration → save.
  • CQ-02: Reproducibility (3/3) - Uses np.random.seed(42) for reproducible scatter.
  • CQ-03: Clean Imports (2/2) - Only necessary imports: numpy, pygal, Style.
  • CQ-04: No Deprecated API (1/1) - Uses current pygal API.
  • CQ-05: Output Correct (1/1) - Saves as plot.png (and plot.html).

Library Features (5/5)

  • LF-01: Distinctive Features (5/5) - Good use of pygal features: XY chart with logarithmic scale, custom Style with large fonts for 4800x2700, stroke_style for dashed lines, dots_size control, legend_at_bottom, HTML export.

Strengths

  • Correct S-N curve implementation with all required elements (data points, Basquin fit, reference lines)
  • Good use of pygal's XY chart with logarithmic scale
  • Custom style properly sized for 4800x2700 canvas with appropriate font sizes
  • Realistic fatigue test data with proper scatter simulation
  • All three material reference values clearly shown (UTS, YS, endurance limit)

Weaknesses

  • X-axis tick labels are compressed/overlapping at higher cycle counts (pygal logarithmic label formatting issue)
  • Legend order could be more intuitive (data → fit → reference lines)

Verdict: APPROVED

This is attempt 3/3 and the implementation scores 77/100, which is above the 50-point threshold for final approval. The plot correctly implements all S-N curve requirements from the specification with good visual quality despite minor x-axis label formatting issues inherent to pygal's logarithmic scale handling.

@github-actions github-actions Bot added quality:77 Quality score 77/100 ai-rejected Quality not OK, triggers update labels Jan 15, 2026
@github-actions github-actions Bot added ai-attempt-3 Third/final repair attempt and removed ai-rejected Quality not OK, triggers update labels Jan 15, 2026
Attempt 3/3 - fixes based on AI review

- Reorder legend series logically: Test Data → Basquin Fit → Reference lines
- Reference lines now ordered by stress value (highest to lowest): Ultimate → Yield → Endurance
- Improves VQ-07 (legend layout) and SC-05 (legend accuracy)
@github-actions
Copy link
Copy Markdown
Contributor Author

🔧 Repair Attempt 3/3

Applied fixes based on AI review feedback.

Status: Repair completed, re-triggering review...


🤖 impl-repair

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Jan 15, 2026

AI Review - Attempt 3/3

Image Description

The plot displays an S-N curve (Wöhler curve) on a semi-logarithmic scale. The X-axis shows "Cycles to Failure (N)" with a logarithmic scale ranging from approximately 100 to 10^7, and the Y-axis shows "Stress Amplitude (MPa)" ranging from about 150 to 550 MPa (linear scale). Orange circular markers represent the test data points showing the characteristic downward trend of fatigue data - high stress at low cycles transitioning to low stress at high cycles. A dashed blue line represents the Basquin fit (S-N curve) that follows the data trend. Three horizontal reference lines are visible: a red line at 520 MPa for Ultimate Strength, a green line at 350 MPa for Yield Strength, and a purple line at 190 MPa for Endurance Limit. The title "sn-curve-basic · pygal · pyplots.ai" appears at the top. The legend is positioned at the bottom, showing all five series. The background is white with subtle grid lines. X-axis tick labels show some crowding/overlap at higher values ("2000...", "4000...60008000000...").

Quality Score: 78/100

Criteria Checklist

Visual Quality (30/40)

  • VQ-01: Text Legibility (7/10) - Title and axis labels readable; tick labels somewhat crowded at high cycle counts
  • VQ-02: No Overlap (4/8) - X-axis tick labels overlap at higher cycle values (showing "2000...", "4000...60008000000...")
  • VQ-03: Element Visibility (8/8) - Data markers clearly visible at appropriate size, lines distinguishable
  • VQ-04: Color Accessibility (5/5) - Orange, blue, red, green, purple are colorblind-friendly and distinct
  • VQ-05: Layout Balance (4/5) - Good canvas utilization, slight imbalance with legend at bottom
  • VQ-06: Axis Labels (2/2) - Both axes have descriptive labels with units (MPa, N)
  • VQ-07: Grid & Legend (0/2) - Legend order differs from visual order (Basquin Fit listed first but Test Data is primary)

Spec Compliance (23/25)

  • SC-01: Plot Type (8/8) - Correct XY scatter plot with fitted curve, appropriate for S-N data
  • SC-02: Data Mapping (5/5) - Cycles on X (log scale), Stress on Y correctly assigned
  • SC-03: Required Features (4/5) - Has data points, fit curve, and reference lines; Y-axis is linear not logarithmic as spec suggests
  • SC-04: Data Range (3/3) - Full range of data visible (10^2 to 10^7 cycles, 190-520 MPa)
  • SC-05: Legend Accuracy (2/2) - Legend labels correctly identify all series with values
  • SC-06: Title Format (2/2) - Uses correct format: sn-curve-basic · pygal · pyplots.ai

Data Quality (18/20)

  • DQ-01: Feature Coverage (8/8) - Shows scatter from multiple specimens, low/high cycle regions, and endurance limit region
  • DQ-02: Realistic Context (7/7) - Steel fatigue testing is a real engineering application with appropriate terminology
  • DQ-03: Appropriate Scale (3/5) - Stress values realistic for steel (190-520 MPa); could extend cycles further into infinite life region

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) - Simple script: imports → data → plot → save (no functions/classes)
  • CQ-02: Reproducibility (3/3) - np.random.seed(42) ensures reproducibility
  • CQ-03: Clean Imports (2/2) - Only necessary imports (numpy, pygal, Style)
  • CQ-04: No Deprecated API (1/1) - Uses current pygal API
  • CQ-05: Output Correct (1/1) - Saves both plot.png and plot.html

Library Features (3/5)

  • LF-01: Uses distinctive library features (3/5) - Uses pygal XY chart, custom Style, logarithmic scale; could leverage tooltips or interactivity more

Strengths

  • Correctly implements S-N curve with logarithmic X-axis and fitted Basquin equation
  • Includes all three key material reference lines (Ultimate Strength, Yield Strength, Endurance Limit)
  • Good use of pygal's custom Style with appropriately sized fonts for 4800x2700 canvas
  • Data shows realistic scatter with multiple test specimens per stress level
  • Color palette is distinct and accessible

Weaknesses

  • X-axis tick labels overlap/truncate at high cycle values due to logarithmic scale rendering in pygal
  • Y-axis is linear but spec recommends both axes use logarithmic scales
  • Legend order (Basquin Fit first) doesn't match the visual prominence order (Test Data is primary)

Verdict: APPROVED

This is attempt 3/3. The implementation successfully creates an S-N curve visualization with the key features: fatigue test data points, a fitted Basquin curve, and material reference lines. While there are some tick label overlap issues inherent to pygal's logarithmic scale handling, the overall quality meets the ≥50 threshold for final attempt acceptance. Score of 78/100 exceeds the minimum threshold.

@github-actions github-actions Bot added quality:78 Quality score 78/100 ai-approved Quality OK, ready for merge labels Jan 15, 2026
@github-actions github-actions Bot merged commit 1534816 into main Jan 15, 2026
3 checks passed
@github-actions github-actions Bot deleted the implementation/sn-curve-basic/pygal branch January 15, 2026 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-approved Quality OK, ready for merge ai-attempt-1 First repair attempt ai-attempt-2 Second repair attempt ai-attempt-3 Third/final repair attempt quality:75 Quality score 75/100 quality:77 Quality score 77/100 quality:78 Quality score 78/100 quality:85 Quality score 85/100

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants