Skip to content

feat(plotnine): implement ohlc-bar#7061

Merged
MarkusNeusinger merged 4 commits into
mainfrom
implementation/ohlc-bar/plotnine
May 17, 2026
Merged

feat(plotnine): implement ohlc-bar#7061
MarkusNeusinger merged 4 commits into
mainfrom
implementation/ohlc-bar/plotnine

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Implementation: ohlc-bar - python/plotnine

Implements the python/plotnine version of ohlc-bar.

File: plots/ohlc-bar/implementations/python/plotnine.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 displays 50 days of stock price data on a warm off-white background (#FAF8F1). The plot uses a clean, minimal style with vertical bars extending from low to high prices, with left-side ticks for opening prices and right-side ticks for closing prices. Green bars (#009E73) represent upward days (close > open), while orange bars (#D55E00) represent downward days (close < open). The title "ohlc-bar · plotnine · anyplot.ai" is clearly visible in dark text at the top. X-axis shows date labels (Jun 03, Jun 17, Jul 01, etc.) and Y-axis shows prices in USD (25-70 range). A subtle grid helps read price levels. The legend on the right clearly labels "Up (Close > Open)" and "Down (Close < Open)". All text elements (title, axis labels, tick labels) are highly readable against the light background. Legibility verdict: PASS

Dark render (plot-dark.png): The same OHLC visualization rendered on a warm near-black background (#1A1A17). All text is now in light colors (title, axis labels, tick labels) against the dark background - all clearly readable with no dark-on-dark failures. The data bar colors are identical to the light render - green (#009E73) for up days and orange (#D55E00) for down days remain equally visible and vibrant. Grid lines are subtle and visible. The legend styling adapts appropriately with a darker background box. Chrome elements (backgrounds, text, grid) have flipped to the dark theme while data colors remain constant. Legibility verdict: PASS

Score: 86/100

Category Score Max
Visual Quality 30 30
Design Excellence 10 20
Spec Compliance 15 15
Data Quality 15 15
Code Quality 10 10
Library Mastery 6 10
Total 86 100

Visual Quality (30/30)

  • VQ-01: Text Legibility (8/8) - Font sizes explicitly set (title 24px, axis titles 20px, tick labels 16px); readable in both light and dark themes
  • VQ-02: No Overlap (6/6) - All text elements well-spaced; no collisions or overlaps
  • VQ-03: Element Visibility (6/6) - All OHLC bars clearly distinguishable; appropriate spacing for 50-day view
  • VQ-04: Color Accessibility (2/2) - Okabe-Ito palette is CVD-safe; good contrast between green and orange
  • VQ-05: Layout & Canvas (4/4) - Good 16:9 proportions; nothing cut off; generous whitespace
  • VQ-06: Axis Labels & Title (2/2) - Title informative; axis labels descriptive with units
  • VQ-07: Palette Compliance (2/2) - Up color is #009E73 (OI-1, brand green); down color is #D55E00 (OI-2); backgrounds correct (#FAF8F1 light, #1A1A17 dark); both renders theme-correct with proper chrome adaptation

Design Excellence (10/20)

  • DE-01: Aesthetic Sophistication (4/8) - Competent use of theme tokens and Okabe-Ito palette; proper backgrounds and text colors; however, relies on theme_minimal() defaults without additional design refinement or visual sophistication
  • DE-02: Visual Refinement (3/6) - Uses theme_minimal() to remove clutter; legend has element_rect styling; grid lines subtle with alpha=0.10; adequate but could benefit from more polish
  • DE-03: Data Storytelling (3/6) - Color distinction (up/down) naturally guides understanding of price movement; shows clear downtrend over time; legend explains the distinction; reasonable visual hierarchy

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) - Correct OHLC bar chart type with vertical bars and horizontal ticks
  • SC-02: Required Features (4/4) - All required features present: vertical high-low lines, left open ticks, right close ticks, up/down color distinction, proper date formatting, grid lines
  • SC-03: Data Mapping (3/3) - X-axis correctly maps dates; Y-axis correctly maps prices; all data visible and properly scaled
  • SC-04: Title & Legend (3/3) - Title format correct ("ohlc-bar · plotnine · anyplot.ai"); legend labels clear and descriptive

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) - Plot shows all OHLC aspects (open, high, low, close) for each period; 50 trading days provides good coverage
  • DQ-02: Realistic Context (5/5) - Synthetic data generated via realistic random walk model (np.random.normal with volatility); starting price 50 with appropriate daily returns (25-70 range is plausible)
  • DQ-03: Appropriate Scale (4/4) - 50 days within spec range (20-100 periods); price values sensible for stock analysis

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) - No unnecessary functions or classes; straightforward data generation and plotting
  • CQ-02: Reproducibility (2/2) - Uses np.random.seed(42) for deterministic output
  • CQ-03: Clean Imports (2/2) - Only imports used: os, numpy, pandas, plotnine functions
  • CQ-04: Code Elegance (2/2) - Appropriate complexity; no fake UI or over-engineering
  • CQ-05: Output & API (1/1) - Saves as plot-{THEME}.png; uses current plotnine API

Library Mastery (6/10)

  • LM-01: Idiomatic Usage (4/5) - Good idiomatic plotnine: ggplot() + geom_*() pattern; proper use of geom_segment for creating bars; theme tokens handled with os.getenv pattern
  • LM-02: Distinctive Features (2/5) - Uses geom_segment composition (layer composition) to build OHLC structure; fairly standard implementation without distinctive library-specific techniques

Score Caps Applied

  • None

Strengths

  • Perfect spec compliance - all OHLC features correctly implemented with proper bar structure
  • Excellent visual quality in both themes - all text readable, proper contrast, no theme-readability failures
  • Correct Okabe-Ito palette usage (green #009E73 for up, orange #D55E00 for down)
  • Theme tokens properly threaded through all chrome elements (backgrounds, text, grid)
  • Clean, reproducible code with deterministic seed and realistic synthetic data
  • Proper date formatting and 50-day sample provides clear visualization of price movements
  • Idiomatic plotnine usage with proper geom composition

Weaknesses

  • Design Excellence below median - relies on theme_minimal() defaults without additional visual sophistication
  • Generic styling lacks distinctive design thinking or visual refinement
  • Could benefit from more intentional visual hierarchy or aesthetic polish

Issues Found

  1. DE-01 MODERATE: Generic styling using default theme_minimal() without additional refinement
    • The implementation correctly applies all required theme tokens and colors, but doesn't add custom design flourishes beyond defaults
    • Fix: Consider adding refined visual touches - e.g., selective legend styling, custom spine handling, or subtle visual emphasis on key price levels
  2. DE-02 MODERATE: Minimal visual refinement
    • Current approach is functional but generic; could benefit from more intentional polish
    • Fix: Fine-tune whitespace, refine grid subtlety, or add strategic visual refinement to elevate the design

AI Feedback for Next Attempt

The implementation correctly executes the OHLC bar chart specification with excellent adherence to the spec, proper theme adaptation, and clean code. The lower Design Excellence score reflects functional-but-generic styling rather than any technical failures. If refinement is desired: consider adding custom visual touches such as refined grid handling, legend box styling, or strategic color emphasis to create a more distinctive look.

Verdict: APPROVED

@github-actions github-actions Bot added quality:86 Quality score 86/100 ai-rejected Quality not OK, triggers update labels May 17, 2026
@github-actions github-actions Bot added ai-attempt-1 First repair attempt and removed ai-rejected Quality not OK, triggers update labels May 17, 2026
@github-actions
Copy link
Copy Markdown
Contributor Author

🔧 Repair Attempt 1/4

Applied fixes based on AI review feedback.

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


🤖 impl-repair

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 17, 2026

AI Review - Attempt 2/3

Image Description

Light render (plot-light.png): The plot displays on a warm off-white background (#FAF8F1) with 50 trading days of OHLC stock price data. The title "ohlc-bar · plotnine · anyplot.ai" is bold and clearly visible in dark INK color (#1A1A17). X-axis labels show dates formatted as "Jun 03", "Jun 17", etc., and Y-axis shows price range 120-170 USD. The OHLC structure is rendered with vertical lines (high-low range), left ticks for open prices, and right ticks for close prices. Up movements are colored in Okabe-Ito green (#009E73) and down movements in Okabe-Ito orange (#D55E00). Subtle horizontal grid lines (alpha=0.10) aid price reading. The legend on the right clearly identifies "Direction" with categories "Up (Close > Open)" and "Down (Close < Open)". All text is fully readable against the light background with proper color contrast.

Dark render (plot-dark.png): The same OHLC structure renders on a warm near-black background (#1A1A17). Title and axis labels are rendered in light INK (#F0EFE8) and tick labels in light INK_SOFT (#B8B7B0), making all text clearly visible against the dark background with no dark-on-dark failures. The OHLC data colors are identical to the light render—green (#009E73) for up bars and orange (#D55E00) for down bars—confirming that only the chrome (background, text, grid, legend) has adapted to the dark theme. The subtle grid lines using the light RULE color are visible without competing with data. All price levels and date markers are equally readable as in the light render.

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) - Title, axis labels, tick labels, legend all explicitly sized and colored; fully readable in both themes
  • VQ-02: No Overlap (6/6) - No overlapping text; OHLC bars well-spaced; legend positioned right without collision
  • VQ-03: Element Visibility (6/6) - Geom segments sized 1.2 (thick bars); distinct colors (green vs orange); all OHLC components clearly visible
  • VQ-04: Color Accessibility (2/2) - Okabe-Ito positions 1–2 CVD-safe; sufficient contrast on both light and dark backgrounds
  • VQ-05: Layout & Canvas (4/4) - Figure size 16×9 (4800×2700px); generous margins; nothing cut off; excellent proportions
  • VQ-06: Axis Labels & Title (2/2) - Title format correct; Y-axis includes unit (USD); X-axis dates properly formatted
  • VQ-07: Palette Compliance (2/2) - First series #009E73 (Okabe-Ito pos 1), second #D55E00 (pos 2); backgrounds #FAF8F1 light / #1A1A17 dark; theme tokens correctly applied; data colors identical between renders

Design Excellence (14/20)

  • DE-01: Aesthetic Sophistication (6/8) - Professional polish with correct color palette, intentional OHLC structure, custom date tick configuration
  • DE-02: Visual Refinement (4/6) - Subtle grid (alpha=0.10), generous whitespace, proper panel background, legend box styling
  • DE-03: Data Storytelling (4/6) - OHLC bars convey price movement narrative; up/down color distinction creates visual hierarchy; clear focal point

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) - Correct OHLC bar chart with vertical high-low lines and horizontal open/close ticks
  • SC-02: Required Features (4/4) - All features present: thin vertical lines, left ticks for open, right ticks for close, up/down color distinction
  • SC-03: Data Mapping (3/3) - X=date, Y=price; vertical segment spans low–high; ticks properly positioned; color=direction
  • SC-04: Title & Legend (3/3) - Title format "ohlc-bar · plotnine · anyplot.ai"; legend clearly shows Direction with readable labels

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) - 50 trading days of realistic OHLC data; all aspects visible; both up and down movements represented
  • DQ-02: Realistic Context (5/5) - Stock price data (150–170 USD) with realistic random walk; business day calendar; neutral content
  • DQ-03: Appropriate Scale (4/4) - Price range 120–170 USD sensible for domain; 50 days ideal for OHLC; realistic daily volatility

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) - No functions, no classes; linear code flow
  • CQ-02: Reproducibility (2/2) - np.random.seed(42) ensures deterministic output
  • CQ-03: Clean Imports (2/2) - Only necessary imports; no unused code
  • CQ-04: Code Elegance (2/2) - Appropriate complexity; no fake UI or simulated interactivity (AR-08 compliant)
  • CQ-05: Output & API (1/1) - Saves as plot-{THEME}.png; current plotnine API

Library Mastery (7/10)

  • LM-01: Idiomatic Usage (4/5) - Uses geom_segment (idiomatic for OHLC); proper aes() mapping; theme_minimal() + custom theme (plotnine pattern)
  • LM-02: Distinctive Features (3/5) - Three geom_segment layers creatively combined to build OHLC structure; demonstrates grammar of graphics mastery

Score Caps Applied

  • None

Strengths

  • Perfect theme adaptation with correct token usage (INK, INK_SOFT changing per theme; PAGE_BG, ELEVATED_BG consistent with spec)
  • Correct OHLC structure with proper color distinction using Okabe-Ito palette (green #009E73 for up, orange #D55E00 for down)
  • All text fully legible in both light and dark renders with no contrast failures
  • Clean, idiomatic plotnine code using multiple geom_segment layers to build OHLC visualization
  • Full specification compliance—all required features (high-low line, open tick, close tick, up/down colors, proper labeling) present

Weaknesses

  • Design could be slightly more sophisticated (custom spine removal, refined typography variations, or additional visual hierarchy could elevate polish from "professional" to "exceptional")

Issues Found

None—implementation meets all quality criteria with no blocking issues.

AI Feedback for Next Attempt

This is an excellent, production-ready implementation. If refinement is desired: consider explicitly removing top and right spines with plot_background=element_blank() + panel_border= adjustments, or adding subtle emphasis to the strongest up/down movements through size variation. Current implementation scores well without these enhancements.

Verdict: APPROVED

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant