Skip to content

feat(bokeh): implement line-stress-strain#9296

Open
github-actions[bot] wants to merge 3 commits into
mainfrom
implementation/line-stress-strain/bokeh
Open

feat(bokeh): implement line-stress-strain#9296
github-actions[bot] wants to merge 3 commits into
mainfrom
implementation/line-stress-strain/bokeh

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Implementation: line-stress-strain - python/bokeh

Implements the python/bokeh version of line-stress-strain.

File: plots/line-stress-strain/implementations/python/bokeh.py

Parent Issue: #4413


🤖 impl-generate workflow

github-actions Bot and others added 2 commits June 21, 2026 09:36
Regen from quality 91. Addressed:
- Canvas: fixed 4800×2700 → canonical 3200×1800 (per bokeh.md)
- Save method: replaced broken export_png with Selenium/CDN approach
  (CDP setDeviceMetricsOverride for exact W×H screenshot)
- Theme support: added ANYPLOT_THEME handling for light/dark
- Colors: migrated to Imprint palette (COLOR_CURVE=#009E73 brand green,
  YIELD=#4467A3 blue, UTS=#C475FD lavender, FRACTURE=#AE3030 matte red,
  OFFSET=#BD8233 ochre)
- Font sizes: 50pt title / 42pt axis labels / 34pt tick labels (canonical)
- Chrome: fully theme-adaptive (INK, INK_SOFT, INK_MUTED, ELEVATED_BG)
- Output: corrected to plot-{THEME}.png / plot-{THEME}.html naming
- Left congestion: moved E annotation right (x=0.04), spread labels
- Legend: theme-adaptive ELEVATED_BG fill, INK_SOFT border/text
- sys.path fix: prevents bokeh.py from shadowing installed bokeh package

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@claude

claude Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

AI Review - Attempt 1/3

Image Description

Light render (plot-light.png): The chart shows an engineering stress-strain curve for mild steel on a warm off-white (#FAF8F1) background. The primary stress-strain curve is rendered in brand green (#009E73) with line_width=5, clearly dominant. Three key points are marked with distinct shapes: a blue circle at yield (250 MPa), a lavender triangle at UTS (400 MPa), and a red square at fracture (~320 MPa). An ochre dashed 0.2% offset line is present but heavily compressed near the y-axis (spanning only ~1% of plot width). Region labels in italic muted text annotate "Elastic", "Strain Hardening", and "Necking". Point annotations in bold match their marker colors. A "E = 210 GPa" annotation in green sits in the lower-left area. A legend with 5 entries is placed bottom-right with semi-transparent warm background. Horizontal dotted reference spans at yield and UTS stress levels add subtle structural context. All text is clearly readable against the light background — no legibility failures.

Dark render (plot-dark.png): The same chart on a warm near-black (#1A1A17) background. Title, axis labels, and tick labels all flip to light-colored text (INK=#F0EFE8 and INK_SOFT=#B8B7B0) — no dark-on-dark failure. The region italic labels use INK_MUTED (#A8A79F), which is sufficiently visible against the dark background. The legend uses an elevated dark background (#242420) with light label text (#B8B7B0). All data colors are identical to the light render — green curve, blue yield circle, lavender UTS triangle, red fracture square, ochre offset dashes — only chrome elements flip. Brand green #009E73 is clearly visible on the dark surface. All text is readable against the dark background, and no dark-on-dark failure is detected.

Both paragraphs are required. A review that only describes one render is invalid.

Score: 89/100

Category Score Max
Visual Quality 28 30
Design Excellence 13 20
Spec Compliance 14 15
Data Quality 15 15
Code Quality 10 10
Library Mastery 9 10
Total 89 100

Visual Quality (28/30)

  • VQ-01: Text Legibility (7/8) — All font sizes explicitly set (50pt title, 42pt axis labels, 34pt ticks, 28pt point annotations, 26pt modulus). Well-proportioned, balanced X/Y axes, readable in both themes. Minor deduction: annotation cluster near the compressed elastic region (left ~2% of x-axis) is slightly dense, though nothing is unreadable.
  • VQ-02: No Overlap (6/6) — No text overlaps detected in either render. Elements are well-spaced despite tight left-axis zone.
  • VQ-03: Element Visibility (5/6) — Main curve (line_width=5) and key-point markers (size=28) are prominent. Deduction: 0.2% offset line spans only ~1% of the x-axis range (x=0.002 to ~0.005 vs total range 0–0.38), appearing as a tiny dashed segment barely distinguishable at chart scale.
  • VQ-04: Color Accessibility (2/2) — Imprint palette is CVD-safe; redundant encoding via distinct marker shapes (circle/triangle/square) for yield/UTS/fracture ensures accessibility.
  • VQ-05: Layout & Canvas (4/4) — Canvas well-utilized. Generous min_border margins. Legend sits in bottom-right without isolating from data.
  • VQ-06: Axis Labels & Title (2/2) — "Engineering Strain (mm/mm)" and "Engineering Stress (MPa)" both include units.
  • VQ-07: Palette Compliance (2/2) — Primary curve is #009E73 ✓. UTS/lavender #C475FD, yield/blue #4467A3, offset/ochre #BD8233, fracture/matte-red #AE3030 (semantic exception for failure — appropriate). Backgrounds #FAF8F1 (light) / #1A1A17 (dark) correct. Chrome is theme-adaptive in both renders.

Design Excellence (13/20)

  • DE-01: Aesthetic Sophistication (5/8) — Above default: semantic red for fracture (intuitive failure color), distinct marker shapes for CVD redundant encoding, two-level italic/bold annotation hierarchy for region vs. point labels, very subtle Span reference lines at yield and UTS. However not yet at "strong design" level (6) — the chart reads as a well-configured, thoughtfully annotated Bokeh chart rather than a publication-quality composition.
  • DE-02: Visual Refinement (4/6) — Y-axis-only grid at alpha=0.12, L-shaped axis frame (outline_line_color=None), minor tick marks removed, semi-transparent elevated legend background. Meaningful refinement above defaults.
  • DE-03: Data Storytelling (4/6) — Clear narrative: region labels guide the viewer through elastic → strain hardening → necking; key point annotations (Yield, UTS, Fracture) connect visual features to engineering properties; E=210 GPa grounds the elastic region contextually. Above default "data display" level.

Spec Compliance (14/15)

  • SC-01: Plot Type (5/5) — Correct stress-strain line chart with all three mechanical behavior regions visible.
  • SC-02: Required Features (3/4) — Region labels ✓, key points marked ✓, Young's modulus text annotation ✓, 0.2% offset line drawn ✓. Deduction: the offset line is technically present but compressed to ~1% of chart width, making the core spec goal of "illustrating yield point determination" visually weak — a viewer cannot clearly follow the offset construction method.
  • SC-03: Data Mapping (3/3) — Strain on x-axis, stress on y-axis, all data visible within axis bounds.
  • SC-04: Title & Legend (3/3) — Title "line-stress-strain · python · bokeh · anyplot.ai" matches required format. Legend shows all 5 elements with descriptive labels.

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) — All aspects of the plot type: elastic region, yield point (0.2% offset method), strain hardening (Ludwik power law), necking, fracture, Young's modulus annotation.
  • DQ-02: Realistic Context (5/5) — Mild steel tensile test: neutral, real-world engineering scenario widely taught in materials science.
  • DQ-03: Appropriate Scale (4/4) — E=210 GPa ✓ (correct for steel), yield=250 MPa ✓ (typical mild steel 200–400 MPa), UTS=400 MPa ✓, fracture strain=0.35 ✓ (steel ductility 20–40%), Ludwik power law model physically accurate.

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) — Clean linear flow: imports → tokens → data → figure → glyphs → annotations → legend → styling → save.
  • CQ-02: Reproducibility (2/2) — np.random.seed(42) set.
  • CQ-03: Clean Imports (2/2) — All imported modules are used.
  • CQ-04: Code Elegance (2/2) — HoverTool is native Bokeh interactive functionality (not fake interactivity). Appropriate complexity for a multi-annotated stress-strain plot.
  • CQ-05: Output & API (1/1) — Saves plot-{THEME}.html and plot-{THEME}.png. Current Bokeh API used.

Library Mastery (9/10)

  • LM-01: Idiomatic Usage (5/5) — Expert usage: ColumnDataSource with custom data columns for tooltip (@region), HoverTool in vline mode, Legend+LegendItem for manual legend construction, Span for reference lines, Label for annotations, add_layout for layout-level elements, CDN resources for HTML export.
  • LM-02: Distinctive Features (4/5) — Region-aware interactive hover tooltips (Strain / Stress / Region) are distinctively Bokeh. Dual artifact output (interactive HTML + static PNG). Span reference lines. Minor deduction: could further leverage Bokeh-specific features (e.g., TapTool, CustomJS callbacks for educational interactivity).

Score Caps Applied

  • None — DE-01=5 > 2 and DE-02=4 > 2, so the "boring cap" (max 75) does not apply.

Strengths

  • Perfect data quality: factually correct mild steel parameters (E=210 GPa, yield=250 MPa, UTS=400 MPa) with a physically accurate Ludwik power law model
  • Excellent palette compliance: semantic matte red (#AE3030) for fracture, CVD-safe shape redundancy (circle/triangle/square), Imprint palette throughout
  • Expert Bokeh idioms: ColumnDataSource with @region column for hover, HoverTool in vline mode, CDN HTML export, Span cross-lines, LegendItem manual construction
  • Two-level annotation hierarchy (italic+muted for region labels, bold+palette for key-point labels) creates clean visual grammar
  • Full theme-adaptive chrome with correct tokens in both renders — no dark-on-dark failures

Weaknesses

  • 0.2% offset line is nearly invisible: the x-axis spans 0–0.38 but the offset line only runs from x=0.002 to ~0.005, making it appear as ~3 tiny dashes next to the y-axis. The spec's core goal of visually illustrating the yield point determination method is not achieved. Fix: either zoom into the elastic-plastic transition region in an inset axes, extend the offset line further (up to x≈0.05 while keeping it below yield stress), or add a text annotation explicitly describing the 0.2% offset construction near the compressed zone.
  • DE-01 at 5/8: design is thoughtful but not yet at "strong design" level. The annotation-heavy left side creates a slightly cluttered zone (elastic label, yield annotation, offset line, E=210 GPa all competing in <3% of the x-axis). Improving the offset line visibility would also help DE-01.

Issues Found

  1. SC-02 MINOR (0.2% offset line barely visible): The offset line is rendered but its x-range (0.002 to ~0.005) is so small relative to the total x-axis (0 to 0.38) that it's imperceptible at chart scale, defeating the spec goal of illustrating the offset construction method.
    • Fix option A: Extend the offset line to x=0.06, cutting it at y=offset_stress < yield_strength. This makes the line's slope and origin-offset clearly visible.
    • Fix option B: Add a small inset axes zoomed into x=[0, 0.01] to show the elastic-plastic transition with the 0.2% offset method clearly illustrated.

AI Feedback for Next Attempt

The core stress-strain chart is very well-executed with excellent data quality, Bokeh mastery, and theme compliance. The single most important fix is making the 0.2% offset line visible: extend it to at least x=0.06 (while keeping it below yield_strength) so its slope and 0.002-strain offset from the elastic line are apparent at chart scale. With that fix, SC-02 reaches 4/4 and VQ-03 reaches 6/6, pushing the score to ~92+ and clearing the Review 1 threshold. Secondarily, consider pulling the elastic-zone annotations (E=210 GPa, Yield label) slightly further right to reduce left-side congestion.

Verdict: REJECTED

@github-actions github-actions Bot added quality:89 Quality score 89/100 ai-rejected Quality not OK, triggers update labels Jun 21, 2026
@github-actions github-actions Bot added ai-attempt-1 First repair attempt ai-rejected Quality not OK, triggers update and removed ai-rejected Quality not OK, triggers update labels Jun 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor Author

🔧 Repair Workflow Crashed (Attempt 1/4) — Auto-Retrying

The repair workflow failed (probably a transient Claude Code Action issue). Automatically re-triggering this attempt...


🤖 impl-repair

@github-actions github-actions Bot added ai-rejected Quality not OK, triggers update and removed ai-rejected Quality not OK, triggers update labels Jun 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor Author

❌ Repair Workflow Crashed (Attempt 1/4, retry exhausted)

The repair workflow itself failed twice for this attempt — likely a persistent Claude Code Action issue.

Manual restart:

gh workflow run impl-repair.yml -f pr_number=9296 -f specification_id=line-stress-strain -f library=bokeh -f attempt=1 -f model=sonnet

🤖 impl-repair

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

Labels

ai-attempt-1 First repair attempt ai-rejected Quality not OK, triggers update quality:89 Quality score 89/100

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants