Skip to content

feat(plotnine): implement candlestick-volume#6881

Merged
MarkusNeusinger merged 4 commits into
mainfrom
implementation/candlestick-volume/plotnine
May 16, 2026
Merged

feat(plotnine): implement candlestick-volume#6881
MarkusNeusinger merged 4 commits into
mainfrom
implementation/candlestick-volume/plotnine

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Implementation: candlestick-volume - python/plotnine

Implements the python/plotnine version of candlestick-volume.

File: plots/candlestick-volume/implementations/python/plotnine.py

Parent Issue: #3068


🤖 impl-generate workflow

@github-actions
Copy link
Copy Markdown
Contributor Author

🔧 AI Review Produced No Score — Auto-Retrying

The Claude Code Action ran but didn't write quality_score.txt. Auto-retrying review once...


🤖 impl-review

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 16, 2026

AI Review - Attempt 1/3

Image Description

Light render (plot-light.png):
The candlestick-volume plot displays correctly with a warm off-white background (#FAF8F1). The upper pane shows Price (OHLC) with green candlesticks (#009E73) for up days and orange (#D55E00) for down days, with thin wicks showing high-low ranges and colored rectangles showing open-close bodies. The lower pane displays Trading Volume as colored bars with the same up/down scheme. The dual-pane layout allocates ~70-75% to price and ~25-30% to volume, sharing a synchronized date axis spanning 2024-01-01 to 2024-03-01. All text (title, axis labels: "Price (OHLC)" and "Trading Volume", tick labels) is dark and clearly readable against the light background with excellent contrast. Grid lines are subtle (15% alpha) and visible without competing with data. No overlapping text, no elements cut off. All candlesticks and volume bars are appropriately sized and clearly distinguishable.

Dark render (plot-dark.png):
The same plot renders on warm near-black (#1A1A17) with data colors identical to the light render — green and orange remain the same across both candlesticks and volume bars. All text has adapted to light colors (consistent with #F0EFE8 token) and is clearly readable with excellent contrast against the dark background. No "dark-on-dark" failures observed. Grid lines remain subtle and visible. The layout, proportions, pane split, and all data elements are identical to the light render, with only chrome (background, text, grid color, borders) adapted for theme. Both renders demonstrate perfect theme-readiness.

Score: 88/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 8 10
Total 88 100

Visual Quality (30/30)

  • VQ-01: Text Legibility (8/8) - All font sizes explicitly set (title 24pt, labels 20pt, ticks 16pt, pane 18pt); all perfectly readable in both themes
  • VQ-02: No Overlap (6/6) - All text fully readable with proper spacing; no collisions between date labels, tick labels, or titles
  • VQ-03: Element Visibility (6/6) - Candlesticks and volume bars optimally sized for 60-period dataset; all elements clearly distinguishable from background
  • VQ-04: Color Accessibility (2/2) - Okabe-Ito green and orange provide high contrast and CVD-safe distinction; no red-green as sole signal
  • VQ-05: Layout & Canvas (4/4) - Perfect balance: upper pane ~73% height, lower ~27%, matching spec requirement of 70-75% / 25-30%; margins well-balanced
  • VQ-06: Axis Labels & Title (2/2) - Descriptive labels with context ("Price (OHLC)", "Trading Volume", "Date"); title format correct
  • VQ-07: Palette Compliance (2/2) - First series #009E73 ✓, second #D55E00 ✓, backgrounds #FAF8F1 (light) / #1A1A17 (dark) ✓, data colors identical across themes ✓, text theme-appropriate ✓

Design Excellence (10/20)

  • DE-01: Aesthetic Sophistication (4/8) - Well-configured library defaults with thoughtful use of Okabe-Ito palette and theme tokens; clean minimal style but not exceptional or custom-designed
  • DE-02: Visual Refinement (4/6) - Uses theme_minimal() effectively; subtle grid (y-axis only, 15% alpha), thin panel borders (size=0.3), reasonable whitespace; minimal additional customization beyond defaults
  • DE-03: Data Storytelling (2/6) - Plot clearly shows price-volume relationship and uses color encoding (green=up, orange=down); layout structure guides reader; no special visual hierarchy, emphasis, or annotations beyond inherent structure

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) - Candlestick chart with OHLC anatomy (wicks, bodies) correct; volume bars in lower pane; dual-pane layout with shared axis
  • SC-02: Required Features (4/4) - All spec requirements present: candlesticks, volume bars, up/down coloring, dual panes, synchronized time axis, proper size proportions, 60-period data
  • SC-03: Data Mapping (3/3) - X-axis dates correct; Y-axis price pane shows OHLC values; Y-axis volume pane shows trading volume; axes scale appropriately; all data visible
  • SC-04: Title & Legend (3/3) - Title format "candlestick-volume · plotnine · anyplot.ai" correct; legend omitted (not needed; colors self-explanatory); pane labels present

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) - Shows all aspects: both bullish (green) and bearish (orange) candles; high and low wicks demonstrate volatility; volume shows significant variation across periods; realistic OHLC patterns
  • DQ-02: Realistic Context (5/5) - Real scenario: stock trading data Jan-Mar 2024; price range 85-110 realistic; volume in millions realistic; neutral, non-controversial topic
  • DQ-03: Appropriate Scale (4/4) - Price proportions align with real market behavior; volume scale plausible; 60-day period (2.5 months) appropriate; log-normal returns realistic

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) - Imports → Data generation → Plot creation → Save; no functions or classes; straightforward linear flow
  • CQ-02: Reproducibility (2/2) - np.random.seed(42) set; deterministic data generation
  • CQ-03: Clean Imports (2/2) - All imports used: sys (path), os (ANYPLOT_THEME), numpy, pandas, plotnine; no unused imports
  • CQ-04: Code Elegance (2/2) - Clean Pythonic code; no over-engineering; proper pandas operations; no fake functionality
  • CQ-05: Output & API (1/1) - Saves as plot-{THEME}.png ✓; ggsave() with dpi=300; current API

Library Mastery (8/10)

  • LM-01: Idiomatic Usage (5/5) - Expert use of plotnine grammar: ggplot() + geom layering; facet_grid() for dual-pane layout (very idiomatic); free_y scales (distinctive ggplot2 pattern); theme() system integrated correctly
  • LM-02: Distinctive Features (3/5) - Uses facet_grid(), a distinctive plotnine/ggplot2 feature for this type of plot; basic geom_segment + geom_rect candlestick implementation is not particularly distinctive (could be replicated in other libs)

Score Caps Applied

  • None - No caps triggered (all categories pass minimum thresholds; DE-01 and DE-02 not both ≤ 2)

Strengths

  • Perfect technical execution: All OHLC specification requirements met; code is clean, reproducible, and follows best practices
  • Excellent theme adaptation: Both light and dark renders readable with appropriate color tokens; data colors identical across themes; chrome adaptive
  • Idiomatic plotnine mastery: Facet_grid() elegantly solves the dual-pane requirement; proper ggplot2 grammar throughout
  • High-quality data: Realistic OHLC patterns with both bullish and bearish periods; appropriate volume variation; deterministic seed for reproducibility
  • Visual clarity and polish: All text explicitly sized and readable; no overlap; proper spacing; high-res output (4800×2700) well-utilized

Weaknesses

  • Design execution is formulaic: While technically correct and clean, the plot doesn't demonstrate exceptional aesthetic choices or custom design elements beyond library defaults (DE-01 = 4/8)
  • Limited visual storytelling: The plot displays data clearly but doesn't create visual hierarchy, focal points, or emphasis beyond the inherent structure; no annotations (DE-03 = 2/6)
  • Minimal visual refinement: Relies primarily on theme_minimal() with standard customization; limited customization of grid styling, whitespace, or decorative removal (DE-02 = 4/6)

Issues Found

None - this is a solid, production-quality implementation. No bugs, no missing features, no theme failures. The candlestick implementation is correct, OHLC data is realistic, and both renders are fully readable and compliant with style guidelines.

AI Feedback for Next Attempt

N/A - Implementation approved at threshold. If future improvements desired: consider custom visual refinements (e.g., subtle spine work, grid alpha adjustment, legend-style labels for up/down) and visual storytelling through color emphasis or size variation to create focal points and guide viewer attention to key patterns.

Verdict: APPROVED

@github-actions github-actions Bot added quality:88 Quality score: 88/100 ai-rejected Quality not OK, triggers update labels May 16, 2026
@github-actions github-actions Bot added ai-attempt-1 First repair attempt and removed ai-rejected Quality not OK, triggers update labels May 16, 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 16, 2026

AI Review - Attempt 2/3

Image Description

Light render (plot-light.png): Candlestick chart displayed on warm off-white background (#FAF8F1) with dual-pane faceted layout. Title "candlestick-volume · plotnine · anyplot.ai" rendered in dark text (24pt, legible). Top pane shows Price (OHLC) with candlestick wicks (thin lines showing high-low range) and bodies (rectangles showing open-close), color-coded by direction: green (#009E73) for up candles, orange (#D55E00) for down candles. Bottom pane shows Trading Volume with bars in matching color scheme. X-axis labeled "Date" with dates from 2024-01-01 to 2024-03-01 (60 trading periods). Y-axis labels in soft gray (16pt), fully readable. Grid lines (y-axis only) subtle and aligned across panes. All text is clearly readable against the light background with no overlap or legibility issues.

Dark render (plot-dark.png): Same plot structure on warm near-black background (#1A1A17). Title and all chrome (axis labels, tick labels, grid, panel borders) rendered in light colors (#F0EFE8 for primary text, #B8B7B0 for secondary). Data colors confirmed identical to light render: green (#009E73) for up candles, orange (#D55E00) for down candles—only the background and text chrome adapt to dark theme. All text is readable with no dark-on-dark failures (no black text on near-black background). Grid lines subtle but visible. Candlesticks and volume bars clearly distinguishable.

Both renders pass legibility checks—all elements readable, proper theme adaptation, data colors consistent across themes.

Score: 91/100

Category Score Max
Visual Quality 30 30
Design Excellence 12 20
Spec Compliance 15 15
Data Quality 15 15
Code Quality 10 10
Library Mastery 9 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) – No overlapping elements, all text fully readable
  • VQ-03: Element Visibility (6/6) – Wicks, bodies, volume bars optimally sized for 60-period dataset, clearly visible
  • VQ-04: Color Accessibility (2/2) – Okabe-Ito palette is CVD-safe; green and orange have sufficient contrast
  • VQ-05: Layout & Canvas (4/4) – 16x9 landscape (4800×2700px), balanced margins, proper pane proportions (price 70-75%, volume 25-30%)
  • VQ-06: Axis Labels & Title (2/2) – Title format correct; Date axis descriptive; facet labels provide pane context
  • VQ-07: Palette Compliance (2/2) – Up=#009E73 (Okabe-Ito pos 1), Down=#D55E00 (pos 2); backgrounds #FAF8F1/#1A1A17; theme-correct chrome in both renders

Design Excellence (12/20)

  • DE-01: Aesthetic Sophistication (4/8) – Well-configured library defaults, professional appearance but no exceptional design flourishes or custom aesthetics
  • DE-02: Visual Refinement (4/6) – Subtle y-axis grid (alpha=0.15), minimal spines via theme_minimal(), generous whitespace, good attention to detail
  • DE-03: Data Storytelling (4/6) – Faceted dual-pane layout effectively guides viewer through price-volume relationship; visual hierarchy evident (price pane is larger); color contrast creates emphasis on direction

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) – Correct candlestick chart with volume bars, dual-pane faceted layout
  • SC-02: Required Features (4/4) – All features present: OHLC candlesticks with wicks and bodies, volume bars, shared x-axis, up/down color scheme, grid lines, proper pane proportions
  • SC-03: Data Mapping (3/3) – X=date, Price pane Y=OHLC (open/high/low/close), Volume pane Y=volume; all data visible and correctly scaled
  • SC-04: Title & Legend (3/3) – Title: 'candlestick-volume · plotnine · anyplot.ai'; legend omitted appropriately (color scheme is self-explanatory for up/down)

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) – Shows both up and down candles, realistic OHLC ranges and spreads, volume variations, candlestick wicks with real high-low ranges
  • DQ-02: Realistic Context (5/5) – Stock price data with lognormal returns, trading volume from exponential distribution, neutral business context
  • DQ-03: Appropriate Scale (4/4) – Price range ~$87–$112 (realistic stock price), volume ~$100k–$3M (realistic trading volume), proportions factually sound

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) – Linear: imports → data generation → plot creation → save; no functions/classes
  • CQ-02: Reproducibility (2/2) – Seed 42 set, fully deterministic results
  • CQ-03: Clean Imports (2/2) – All imports used, no bloat (sys, os, numpy, pandas, plotnine)
  • CQ-04: Code Elegance (2/2) – Pythonic, appropriate complexity, no over-engineering, no fake functionality
  • CQ-05: Output & API (1/1) – Saves as plot-{THEME}.png via ggsave(), current plotnine API

Library Mastery (9/10)

  • LM-01: Idiomatic Usage (5/5) – Expert idiomatic plotnine: ggplot() + geom_segment (wicks) + geom_rect (bodies) + geom_col (volume) + facet_grid (dual-pane) + custom theme()
  • LM-02: Distinctive Features (4/5) – Leverages facet_grid with free_y scales (plotnine's strength for multi-panel plots), layered geom composition

Score Caps Applied

  • None — no auto-reject conditions triggered, no cap-limiting issues

Strengths

  • Perfect visual quality with explicit font sizing throughout (title 24pt, labels 20pt, ticks 16pt)
  • Accurate theme adaptation: identical data colors across light/dark renders, theme-correct chrome throughout both
  • Excellent spec compliance: all features present (dual-pane layout, proper proportions, OHLC candlesticks, volume bars, up/down color scheme)
  • Clean code structure with proper data generation (seed=42), deterministic, no over-engineering
  • Strong idiomatic plotnine usage: layered geoms (segment + rect + col), facet_grid with free_y scales, proper theming with element_* functions

Weaknesses

  • Design Excellence (DE-01) scores 4/8: Implementation is technically excellent but uses standard library styling without custom aesthetic choices; could add unique visual refinement such as custom color harmonies, refined typography hierarchy, or publication-ready design touches

Issues Found

None — implementation meets all requirements. Design Excellence is solid but not exceptional, which is appropriate for a well-executed technical/analytical plot without custom design requirements.

AI Feedback for Next Attempt

If design enhancement is desired: consider refining typography weights, adding subtle visual accents (e.g., custom panel borders with theme-aware colors), or introducing a refined color harmony beyond Okabe-Ito to elevate aesthetic sophistication.

Verdict: APPROVED

This implementation scores 91/100 and exceeds the Attempt 2 threshold (≥80). Ready for merge.

@github-actions github-actions Bot added quality:91 Quality score 91/100 ai-approved Quality OK, ready for merge and removed quality:88 Quality score: 88/100 labels May 16, 2026
@MarkusNeusinger MarkusNeusinger merged commit 0fa0e8f into main May 16, 2026
6 checks passed
@MarkusNeusinger MarkusNeusinger deleted the implementation/candlestick-volume/plotnine branch May 16, 2026 05: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 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