Skip to content

feat(matplotlib): implement ohlc-bar#7056

Merged
MarkusNeusinger merged 2 commits into
mainfrom
implementation/ohlc-bar/matplotlib
May 17, 2026
Merged

feat(matplotlib): implement ohlc-bar#7056
MarkusNeusinger merged 2 commits into
mainfrom
implementation/ohlc-bar/matplotlib

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Implementation: ohlc-bar - python/matplotlib

Implements the python/matplotlib version of ohlc-bar.

File: plots/ohlc-bar/implementations/python/matplotlib.py

Parent Issue: #3293


🤖 impl-generate workflow

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 17, 2026

AI Review - Attempt 1/3

Image Description

Light render (plot-light.png): The OHLC bar chart renders on a warm off-white background (#FAF8F1) with excellent legibility. The title "ohlc-bar · matplotlib · anyplot.ai" is clearly visible in dark text (font size 24pt). X-axis displays formatted dates (Jun 03 through Aug 05) at 16pt, and the Y-axis shows "Price (USD)" with tick labels clearly readable. The OHLC bars use brand green (#009E73) for up days and vermillion (#D55E00) for down days—both colors are Okabe-Ito compliant and distinctly readable against the light surface. The legend in the upper left shows both series with appropriate styling on a slightly elevated background (#FFFDF6). Grid lines are subtle (alpha ~0.15) and aid price-level reading. All spines except left and bottom are removed. No overlapping text, no contrast failures.

Dark render (plot-dark.png): The same OHLC bars render on a warm near-black background (#1A1A17) with identical data colors—green and orange are unchanged, confirming proper theme-independence for categorical data. Title, axis labels, and tick labels are rendered in light text (#F0EFE8, #B8B7B0) and are perfectly readable against the dark surface. The legend frame uses the elevated dark surface (#242420) with light text, maintaining excellent contrast. Grid lines remain subtle and consistent. No dark-on-dark failures—all text is light-colored and fully legible. The plot background is clearly warm near-black, not pure black. Both renders pass the theme-readability check completely.

Score: 91/100

Category Score Max
Visual Quality 30 30
Design Excellence 14 20
Spec Compliance 15 15
Data Quality 15 15
Code Quality 10 10
Library Mastery 7 10
Total 91 100

Visual Quality (30/30)

  • VQ-01: Text Legibility (8/8) - All font sizes explicitly set (title 24pt, labels 20pt, ticks 16pt); perfectly readable in both themes
  • VQ-02: No Overlap (6/6) - Zero text overlap; all elements fully readable with good spacing
  • VQ-03: Element Visibility (6/6) - OHLC bars optimally sized for 45 data points; line width 2.0 with round caps; all markers clearly visible
  • VQ-04: Color Accessibility (2/2) - Okabe-Ito palette with strong contrast; CVD-safe; distinguishable beyond hue
  • VQ-05: Layout & Canvas (4/4) - Plot fills 50-80% of canvas; balanced margins; legend well-positioned; generous whitespace
  • VQ-06: Axis Labels & Title (2/2) - Title includes spec-id, library, and brand; Y-axis "Price (USD)" includes units
  • VQ-07: Palette Compliance (2/2) - First series #009E73 (brand green), second #D55E00 (Okabe-Ito Add Claude Code GitHub Workflow #2); backgrounds #FAF8F1 (light)/#1A1A17 (dark); theme-adaptive chrome perfect in both renders

Design Excellence (14/20)

  • DE-01: Aesthetic Sophistication (5/8) - Well-configured professional styling; thoughtful color choices for up/down; clean typography hierarchy; not exceptionally unique but above generic defaults
  • DE-02: Visual Refinement (5/6) - L-shaped spine removal; subtle grid with appropriate alpha (0.15 y-axis, 0.08 x-axis); generous whitespace; legend styled with elevated background
  • DE-03: Data Storytelling (4/6) - Visual hierarchy guides viewer; color encoding (green/orange) immediately conveys up/down; data tells clear story of price volatility over 45 trading days; minor: could emphasize focal points slightly more

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) - Perfect OHLC bar implementation; both up and down bars present
  • SC-02: Required Features (4/4) - Thin vertical high-low lines ✓; horizontal ticks for open (left) and close (right) ✓; color differentiation ✓; date formatting ✓; grid for price levels ✓
  • SC-03: Data Mapping (3/3) - X-axis: date (time); Y-axis: price (numeric); all 45 periods visible; axes show full data range
  • SC-04: Title & Legend (3/3) - Title format "ohlc-bar · matplotlib · anyplot.ai" correct; legend labels "Up (Close ≥ Open)" and "Down (Close < Open)" descriptive

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) - Shows up bars AND down bars; varied price ranges; realistic intraday volatility; trend visible over time
  • DQ-02: Realistic Context (5/5) - Stock price data in realistic range ($128–$170); neutral financial scenario; plausible technical analysis context
  • DQ-03: Appropriate Scale (4/4) - 45 trading days (~2 months) is appropriate window; returns generated with 0.1% daily bias and 2% volatility are realistic; proportions factually sound

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) - Linear: imports → theme tokens → data generation → plot → save; no functions/classes
  • CQ-02: Reproducibility (2/2) - np.random.seed(42) ensures deterministic output
  • CQ-03: Clean Imports (2/2) - All imports used; no extraneous dependencies
  • CQ-04: Code Elegance (2/2) - Clean, Pythonic code; appropriate low-level complexity for manual OHLC bar drawing; no fake UI
  • CQ-05: Output & API (1/1) - Saves as plot-{THEME}.png with correct naming convention

Library Mastery (7/10)

  • LM-01: Idiomatic Usage (4/5) - Proper Axes methods (ax.plot, ax.set_*); correct figure/axes pattern; theme-adaptive tokens; manual line drawing is idiomatic for OHLC
  • LM-02: Distinctive Features (3/5) - Custom legend with Line2D; theme-adaptive chrome implementation; matplotlib.dates for formatting; mostly standard OHLC approach

Score Caps Applied

  • None - No caps triggered

Strengths

  • Theme-Perfect Chrome: Both light and dark renders pass comprehensive readability checks; backgrounds, text, and grid colors are theme-correct and maintain excellent contrast
  • Spec Mastery: All OHLC features present; horizontal ticks for open/close, vertical lines for ranges, appropriate color differentiation, professional date formatting
  • Okabe-Ito Compliance: Brand green (#009E73) for up series matches specification exactly; orange (#D55E00) for down series is Okabe-Ito position 2
  • Typography Excellence: All font sizes explicitly set (24/20/16pt); zero overlap; perfect readability at 4800×2700px
  • Data-Driven Example: 45-day random walk with realistic returns demonstrates full range of OHLC features without abstract labels
  • Code Clarity: Simple, linear structure with no over-engineering; reproducible with seed 42; clean imports

Weaknesses

  • Design Excellence Cap: While visually excellent, the implementation follows standard best practices rather than introducing distinctive design innovations. The Okabe-Ito palette and refined defaults leave room for bolder aesthetic choices (e.g., custom typography weights, emphasis techniques, data-focused color contrast).

Issues Found

  • None requiring repair. The implementation is publication-ready.

AI Feedback for Next Attempt

  • Not applicable—this implementation is approved for immediate merge at Review 1 (≥90).

Verdict: APPROVED


Summary: This is an exemplary implementation of the OHLC bar chart specification. It achieves perfect scores on Visual Quality (30/30), Spec Compliance (15/15), Data Quality (15/15), and Code Quality (10/10). Theme-adaptive styling is flawless in both light and dark renders. Design Excellence (14/20) reflects strong visual refinement and data storytelling, with room only for more distinctive aesthetic innovations. The implementation is ready for production publication.

@github-actions github-actions Bot added quality:91 Quality score 91/100 ai-approved Quality OK, ready for merge labels May 17, 2026
@MarkusNeusinger MarkusNeusinger merged commit 9662db5 into main May 17, 2026
3 checks passed
@MarkusNeusinger MarkusNeusinger deleted the implementation/ohlc-bar/matplotlib branch May 17, 2026 10:38
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 quality:91 Quality score 91/100

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant