Skip to content

feat(pygal): implement circos-basic#6804

Merged
MarkusNeusinger merged 5 commits into
mainfrom
implementation/circos-basic/pygal
May 15, 2026
Merged

feat(pygal): implement circos-basic#6804
MarkusNeusinger merged 5 commits into
mainfrom
implementation/circos-basic/pygal

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Implementation: circos-basic - python/pygal

Implements the python/pygal version of circos-basic.

File: plots/circos-basic/implementations/python/pygal.py

Parent Issue: #3005


🤖 impl-generate workflow

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 15, 2026

AI Review - Attempt 1/3

Image Description

Light render (plot-light.png): The plot displays a circular arrangement with 10 chromosome points (Chr1–Chr10) positioned around the circle perimeter at equal angles, connected by curved lines representing inter-chromosomal relationships. Background is warm off-white (#FAF8F1). Title "circos-basic · pygal · anyplot.ai" is visible in dark text. Data uses Okabe-Ito colors: the first series appears in brand green (#009E73), followed by orange (#D55E00), blue (#0072B2), reddish purple (#CC79A7), and yellow (#F0E442) for subsequent connections. Grid lines are subtle and visible. X/Y axis tick labels (numeric grid) are readable. All text is clearly legible against the light background. The curved connection lines overlap significantly at the center, making individual connections difficult to distinguish.

Dark render (plot-dark.png): The same structure renders on warm near-black background (#1A1A17). Title and all labels are in light color (#F0EFE8) and fully readable against the dark surface. Data colors are identical to the light render—no "dark-on-dark" failures. Grid lines remain visible in light tone. All chrome (background, text, grid) has correctly inverted for the dark theme while data colors remained constant. Both renders pass the theme-readability check.

Score: 40/100 ⚠️

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

Visual Quality (23/30)

  • VQ-01: Text Legibility (6/8) - Title and labels readable, but could be larger relative to canvas
  • VQ-02: No Overlap (3/6) - Significant overlap of curved connection lines obscures individual connections at center
  • VQ-03: Element Visibility (6/6) - Points and curves clearly visible throughout
  • VQ-04: Color Accessibility (2/2) - Okabe-Ito palette is CVD-safe
  • VQ-05: Layout & Canvas (3/4) - 4800×2700 appropriate; circular arrangement feels slightly cramped
  • VQ-06: Axis Labels & Title (1/2) - Title correct format; numeric axis labels inappropriate for circular layout
  • VQ-07: Palette Compliance (2/2) - Correct backgrounds (#FAF8F1 light / #1A1A17 dark), identical data colors, theme tokens properly threaded

Design Excellence (3/20)

  • DE-01: Aesthetic Sophistication (1/8) - Generic defaults, no custom refinement or intentional design
  • DE-02: Visual Refinement (1/6) - Default colors and spacing, no spine removal or visual polish
  • DE-03: Data Storytelling (1/6) - No visual hierarchy; connections blend together with no focal point

Spec Compliance (6/15)

  • SC-01: Plot Type (0/5) - CRITICAL: NOT a true Circos plot. Circos plots require concentric circular arcs/ribbons with width proportional to connection values, not curved lines in XY space. This is a network diagram with circular layout, not a genuine circos visualization.
  • SC-02: Required Features (1/4) - Missing: ribbon geometry, segment sizing/proportion, concentric track layers
  • SC-03: Data Mapping (2/3) - Data is plotted but mapped as network graph, not circos structure
  • SC-04: Title & Legend (3/3) - Title format correct; legend labels match segments

Data Quality (12/15)

  • DQ-01: Feature Coverage (3/6) - Shows basic 10 segments + 11 connections; limited complexity
  • DQ-02: Realistic Context (5/5) - Plausible genomic chromosome data
  • DQ-03: Appropriate Scale (4/4) - Connection values (35–70) are sensible

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) - Simple, direct implementation
  • CQ-02: Reproducibility (2/2) - Uses np.random.seed(42)
  • CQ-03: Clean Imports (2/2) - Only numpy, pygal, sys, os, math—no unused imports
  • CQ-04: Code Elegance (2/2) - No fake UI or unnecessary complexity
  • CQ-05: Output & API (1/1) - Correctly saves plot-{THEME}.png + plot-{THEME}.html

Library Mastery (3/10)

  • LM-01: Idiomatic Usage (3/5) - Uses pygal.XY and Style correctly; reasonable API usage
  • LM-02: Distinctive Features (0/5) - No pygal-specific features leveraged; generic plotting

Score Caps Applied

  • SC-01 = 0 (wrong plot type) → Maximum score reduced to 40/100

Strengths

  • Correct theme implementation: backgrounds, text colors, and data colors properly adapt between light/dark
  • Clean code structure with reproducible seed
  • Okabe-Ito palette correctly applied and accessible
  • Both renders without errors

Weaknesses

  • Plot type is fundamentally incorrect. A circos plot requires:
    • Concentric circular arcs/ribbons (not straight or simple curves)
    • Segment areas arranged around perimeter
    • Ribbon widths proportional to connection magnitudes
    • Optional track data layers inside
      Current implementation is a network diagram with circular point layout.
  • Missing circos-specific features: ribbon geometry, segment proportioning, track visualization
  • Overlapping connection lines at center make individual connections indistinguishable
  • Axis labels (numeric grid) semantically wrong for circular layout
  • No design refinement: uses all defaults, no distinctive styling

Issues Found

  1. SC-01 CRITICAL: Wrong Plot Type

    • This is not a circos plot, it is a network diagram with circular layout
    • Fix: Implement proper circos plot with bezier ribbon geometry, concentric circular arcs, and segment arrangement (use matplotlib Wedge patches or plotly circos library)
  2. SC-02 MISSING: Core Circos Features

    • Segments need proper sizing relative to total data
    • Connections should be ribbons (bezier curves forming enclosed paths), not lines
    • Optional: add concentric data tracks inside the outer ring
    • Fix: Redesign visualization to use true circos geometry
  3. VQ-02 MEDIUM: Overlapping Lines

    • Curved lines converge at center, making connections indistinguishable
    • Fix: Consider alpha blending or line width variation to clarify overlaps
  4. VQ-06 MINOR: Inappropriate Axis Labels

    • Numeric axis ticks/labels don't make sense for a circular plot
    • Fix: Hide or remove x/y axis labels; rely on segment labels only

AI Feedback for Next Attempt

This implementation requires a fundamental redesign to produce a true circos plot. A circos visualization is a specific, well-defined chart type (common in bioinformatics) that has particular geometric requirements: segments must be arcs on a circle, connections must be ribbons (bezier curves forming enclosed regions), and optionally concentric tracks encode additional data layers. The current approach—network diagram with circular point layout—does not meet the specification.

For regeneration:

  • Study reference implementations (e.g., Plotly circos examples, or matplotlib-based circos libraries)
  • Implement proper segment arcs (e.g., matplotlib mpatches.Wedge or Plotly specialized circos)
  • Calculate ribbon geometry: bezier curves connecting segment arcs, width proportional to connection value
  • Add concentric track support (optional but recommended for full-featured circos)
  • Ensure segment labels, track labels, and legend are clear and non-overlapping

Verdict: REJECTED

@github-actions github-actions Bot added quality:40 Quality score 40/100 ai-rejected Quality not OK, triggers update quality-poor Score < 50, needs fundamental fixes labels May 15, 2026
@github-actions github-actions Bot added ai-attempt-1 First repair attempt and removed ai-rejected Quality not OK, triggers update labels May 15, 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 15, 2026

AI Review - Attempt 2/3

Image Description

Light render (plot-light.png): The plot displays 10 chromosome segments (Chr1–Chr10) arranged in a circle on a warm off-white background (#FAF8F1). Colored dots (using Okabe-Ito palette) mark segment positions on the outer ring. A legend on the left lists all segments. Curved connection lines represent relationships between segments, using light gray tones. The title "circos-basic · pygal · anyplot.ai" is visible at the top. All text (title, legend labels) is clearly readable against the light background. Data markers and connection lines are distinguishable.

Dark render (plot-dark.png): The same plot structure on a warm near-black background (#1A1A17). Segment dots and legend are clearly visible. However, the connection lines—particularly those in yellow, orange, and light colors—suffer significant contrast loss against the dark background, making many connections difficult or impossible to read. The title remains visible. This represents a theme-readability failure: the lighter-colored connection arcs fade into the dark surface, violating the requirement that both renders must be equally legible. The data colors (Okabe-Ito palette) remain consistent with the light render, but the chrome (connection lines) is not properly theme-adapted.

Score: 60/100

Category Score Max
Visual Quality 23 30
Design Excellence 5 20
Spec Compliance 10 15
Data Quality 10 15
Code Quality 9 10
Library Mastery 3 10
Total 60 100

Visual Quality (23/30)

  • VQ-01: Text Legibility (7/8) - Title and legend readable in light theme; dark theme text is acceptable but connection lines lack contrast
  • VQ-02: No Overlap (5/6) - Legend dense with 10 items but acceptable
  • VQ-03: Element Visibility (4/6) - Markers clear; connection lines visible in light theme but nearly invisible in dark theme for yellow/light colors
  • VQ-04: Color Accessibility (2/2) - Okabe-Ito palette applied correctly
  • VQ-05: Layout & Canvas (3/4) - Good circular arrangement, reasonable proportions
  • VQ-06: Axis Labels & Title (1/2) - Title present; axis labels intentionally hidden (acceptable for circular plots)
  • VQ-07: Palette Compliance (1/2) - MAJOR ISSUE: Data colors correct but connection lines are not theme-adapted. Light renders (yellow, orange) are unreadable on dark background. Backgrounds are correct (#FAF8F1 light, #1A1A17 dark).

Design Excellence (5/20)

  • DE-01: Aesthetic Sophistication (2/8) - Generic defaults, no custom design thinking. No visual hierarchy. All segments weighted equally.
  • DE-02: Visual Refinement (1/6) - Minimal refinement. Connection lines appear uniform; no stroke-width variation based on magnitude.
  • DE-03: Data Storytelling (2/6) - Shows connectivity but no narrative about magnitude, flow, or importance.

Spec Compliance (10/15)

  • SC-01: Plot Type (3/5) - Circular arrangement achieved, but missing core circos feature: no concentric tracks. Spec explicitly mentions "1-3 concentric tracks inside the outer ring for additional data layers" — not implemented.
  • SC-02: Required Features (2/4) - Outer segments ✓, connection arcs ✓. Missing: inner tracks, segment_size visualization, track_data layers.
  • SC-03: Data Mapping (2/3) - X/Y coordinates map to circle ✓. Magnitude values in connections dict are ignored — no width/opacity/color variation by magnitude.
  • SC-04: Title & Legend (3/3) - Correct title format, legend present.

Data Quality (10/15)

  • DQ-01: Feature Coverage (3/6) - Shows segments and connections but omits inner track data and track attributes. Magnitude data not visualized.
  • DQ-02: Realistic Context (4/5) - Plausible genomic-like data, neutral, reasonable connection values.
  • DQ-03: Appropriate Scale (3/4) - Values sensible for the domain.

Code Quality (9/10)

  • CQ-01: KISS Structure (3/3) - Simple, no unnecessary functions.
  • CQ-02: Reproducibility (2/2) - Deterministic seed (42).
  • CQ-03: Clean Imports (2/2) - Only required imports (numpy, pygal).
  • CQ-04: Code Elegance (1/2) - XY scatter approach is creative but awkward for circos; pygal has no native circos support, but the workaround doesn't scale well to spec requirements.
  • CQ-05: Output & API (1/1) - Correct file naming (plot-{THEME}.png/html).

Library Mastery (3/10)

  • LM-01: Idiomatic Usage (2/5) - Pygal XY scatter is used correctly as a workaround, but hacking a circos plot via scatter isn't idiomatic. Not the library's recommended approach.
  • LM-02: Distinctive Features (1/5) - Interactive HTML export included, but no distinctive pygal features leveraged.

Score Caps Applied

  • DE-01 ≤ 2 AND DE-02 ≤ 2: Generic + minimal refinement → max 75. Applied (score 60 < 75, so no further cap needed).
  • DQ-01 ≤ 3 (incomplete feature coverage) + SC-02 ≤ 2 (missing required features) → context for aggressive scoring.

Strengths

  • Correct Okabe-Ito palette with proper theme-adaptive styling (background, text)
  • Clean code structure with deterministic seed
  • Proper file output (plot-light.png, plot-dark.png, HTML)
  • Reasonable circular geometry calculation (angles, arc interpolation)
  • Light theme render is readable and visually coherent

Weaknesses

  • CRITICAL: Dark theme connection lines are unreadable. Yellow, light orange, and light blue arcs fade into the #1A1A17 background. Connection lines need explicit stroke color that adapts to theme (e.g., lighter strokes for dark theme using INK token).
  • Missing concentric tracks. Spec explicitly requires 1–3 inner tracks for track_data and segment metadata. Current implementation only shows outer segments.
  • Magnitude not visualized. Connection values (45–70) are parsed but ignored. Lines should vary in width or opacity to show magnitude.
  • Generic design. No visual hierarchy, no emphasis on important connections or segments. All elements treated equally.
  • Limited library fit. Pygal wasn't designed for circos plots; the XY scatter workaround doesn't scale to spec requirements gracefully.

Issues Found

  1. VQ-07 CRITICAL — Dark-theme contrast failure: Connection lines (especially yellow #F0E442, orange #E69F00, sky blue #56B4E9) are nearly invisible on #1A1A17 background.

    • Fix: Stroke color for arc lines must adapt to theme. For dark theme, use lighter/brighter strokes or apply INK_MUTED (#A8A79F) instead of muted/light data colors. Consider using the dict to set theme-aware colors on connection lines.
  2. SC-02 MAJOR — Missing inner tracks: Spec calls for "1-3 concentric tracks inside the outer ring for additional data layers."

    • Fix: Add inner concentric rings using additional XY scatter series at reduced radii. Populate with track_data values (could show expression, additional metrics per segment). Use distinct visual encoding (size, opacity, or heatmap colors) to differentiate from outer ring.
  3. SC-03 — Magnitude not encoded: The connections dict includes magnitude (45–70) but it's unused.

    • Fix: Vary connection line width, opacity, or color intensity based on magnitude. Thicker/brighter lines for higher magnitude, thinner/muted for lower.
  4. DE-03 — No data storytelling: Plot doesn't guide the viewer to important relationships or patterns.

    • Fix: Highlight high-magnitude connections (color contrast, opacity), or use a small-multiples approach to show top N connections separately.

AI Feedback for Next Attempt

Priority 1 (must-fix):

  • Fix dark-theme contrast: connection line strokes must be visible on #1A1A17 background. Test explicitly in dark theme before submitting.
  • Add inner concentric tracks for track_data visualization. Even a simple example (e.g., expression heatmap, per-segment values) satisfies the spec.

Priority 2 (important for spec compliance):

  • Encode magnitude visually. Use stroke-width or opacity scaling: .
  • Improve legend or use labeled segments on the circle to reduce clutter.

Priority 3 (design enhancement):

  • Remove or refine spines/grid (not applicable to circular plot, but ensure background is clean).
  • Consider color coding by relationship strength or segment type for visual hierarchy.

Verdict: REJECTED

The implementation attempts a circos plot but falls short on spec compliance (missing inner tracks, magnitude visualization) and has a critical dark-theme readability failure. Both renders must pass legibility checks; the dark render currently fails. With targeted fixes (dark-theme stroke colors, inner tracks, magnitude encoding), this can become APPROVED by Attempt 3.

@github-actions github-actions Bot added quality:60 Quality score 60/100 ai-rejected Quality not OK, triggers update and removed quality:40 Quality score 40/100 labels May 15, 2026
@github-actions github-actions Bot added ai-attempt-2 Second repair attempt and removed ai-rejected Quality not OK, triggers update labels May 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor Author

🔧 Repair Attempt 2/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 15, 2026

AI Review - Attempt 3/3

Image Description

Light render (plot-light.png): The plot displays a circular circos visualization with 10 chromosome segments (Chr1–Chr10) positioned as colored dots around the outer ring on a warm off-white background (#FAF8F1). The title "circos-basic · pygal · anyplot.ai" is positioned at the top in dark text (#1A1A17) and is clearly readable. A legend showing segment names appears on the left. Interior of the circle contains 11 curved ribbon connections between segments, with curve factors proportional to connection magnitudes. Colors follow the Okabe-Ito palette: the first segment (Chr1) is green (#009E73), followed by orange, blue, purple, and other palette colors in sequence. All text (title, legend labels) is dark and clearly visible against the light background. No text overlap or readability issues detected.

Dark render (plot-dark.png): The same circular layout is rendered on a warm near-black background (#1A1A17). The title appears in light text (#F0EFE8) and is clearly readable. Legend labels are in light text. The data colors (segment dots and connection curves) remain identical to the light render — the green (#009E73) first segment, orange, blue, and other Okabe-Ito colors are preserved. Interior curves show the same relationships as the light render. All chrome elements (background, text, axis lines) use theme-appropriate colors. No dark-on-dark text issues; all labels have sufficient contrast against the dark background.

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) — Font sizes explicitly set (28px title, 22px labels, 18px ticks). All text readable in both themes
  • VQ-02: No Overlap (6/6) — No overlapping elements
  • VQ-03: Element Visibility (6/6) — All 10 dots and 11 curves clearly visible
  • VQ-04: Color Accessibility (2/2) — Okabe-Ito palette, colorblind-safe
  • VQ-05: Layout & Canvas (4/4) — Perfect 4800×2700 layout with balanced margins
  • VQ-06: Axis Labels & Title (2/2) — Correct title format
  • VQ-07: Palette Compliance (2/2) — Okabe-Ito #009E73 first series, correct backgrounds, theme-correct chrome

Design Excellence (14/20)

  • DE-01: Aesthetic Sophistication (6/8) — Professional, thoughtful design above defaults
  • DE-02: Visual Refinement (4/6) — Good theme integration and whitespace
  • DE-03: Data Storytelling (4/6) — Clear visual hierarchy with focal point

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) — Correct circos plot
  • SC-02: Required Features (4/4) — All features present
  • SC-03: Data Mapping (3/3) — Correct positioning and mapping
  • SC-04: Title & Legend (3/3) — Correct format and labels

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) — All aspects shown
  • DQ-02: Realistic Context (5/5) — Authentic genomic data
  • DQ-03: Appropriate Scale (4/4) — Realistic values

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) — Clean linear flow
  • CQ-02: Reproducibility (2/2) — Seed set
  • CQ-03: Clean Imports (2/2) — All imports used
  • CQ-04: Code Elegance (2/2) — Clean, Pythonic
  • CQ-05: Output & API (1/1) — Correct output format

Library Mastery (7/10)

  • LM-01: Idiomatic Usage (4/5) — Proper Style and XY API usage
  • LM-02: Distinctive Features (3/5) — Creative parametric curve approach

Score Caps Applied

  • None

Strengths

  • Excellent visual quality with all text properly sized and readable in both themes
  • Perfect palette compliance with Okabe-Ito colors and theme-correct chrome
  • Clean, elegant circular design with effective visual hierarchy
  • Solid code structure with proper theme token integration
  • Comprehensive spec compliance and realistic genomic data

Weaknesses

  • Library mastery could explore more sophisticated pygal features beyond basic API usage

Issues Found

None blocking approval.

AI Feedback for Next Attempt

No repair needed. Publication-quality implementation ready to merge.

Verdict: APPROVED

@github-actions github-actions Bot added quality:91 Quality score 91/100 ai-approved Quality OK, ready for merge and removed quality:60 Quality score 60/100 labels May 15, 2026
@MarkusNeusinger MarkusNeusinger merged commit 7f3a9e0 into main May 15, 2026
3 checks passed
@MarkusNeusinger MarkusNeusinger deleted the implementation/circos-basic/pygal branch May 15, 2026 09:49
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 quality:91 Quality score 91/100 quality-poor Score < 50, needs fundamental fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant