Skip to content

feat(letsplot): implement heatmap-risk-matrix#4952

Open
github-actions[bot] wants to merge 6 commits intomainfrom
implementation/heatmap-risk-matrix/letsplot
Open

feat(letsplot): implement heatmap-risk-matrix#4952
github-actions[bot] wants to merge 6 commits intomainfrom
implementation/heatmap-risk-matrix/letsplot

Conversation

@github-actions
Copy link
Contributor

Implementation: heatmap-risk-matrix - letsplot

Implements the letsplot version of heatmap-risk-matrix.

File: plots/heatmap-risk-matrix/implementations/letsplot.py

Parent Issue: #4567


🤖 impl-generate workflow

@claude
Copy link
Contributor

claude bot commented Mar 17, 2026

AI Review - Attempt 1/3

Image Description

The plot displays a 5×5 risk assessment matrix with Likelihood on the x-axis (Rare to Almost Certain) and Impact on the y-axis (Negligible to Catastrophic). Background tiles are color-coded: green for Low risk (scores 1–4), yellow for Medium (5–9), orange for High (10–16), and red for Critical (20–25). Each cell shows its risk score in semi-transparent gray text. Fifteen risk items are plotted as colored dots — blue for Technical, purple for Financial, orange for Operational — with bold black labels and slight jitter. Two legends appear on the right: Risk Level (color tiles) and Category (dot colors). White borders separate cells. Title reads "heatmap-risk-matrix · lets-plot · pyplots.ai". Several label pairs overlap: "Server Outage"/"Data Breach" at (2,5), "Key Staff Loss"/"Regulatory Change" at (3,4), and "Budget Overrun"/"Supply Delay" at (4,3).

Score: 80/100

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

Visual Quality (22/30)

  • VQ-01: Text Legibility (8/8) — All font sizes explicitly set: title=24, axis_title=20, axis_text=16, legend_title=18, legend_text=14
  • VQ-02: No Overlap (3/6) — Multiple label pairs overlap: "Server Outage"/"Data Breach", "Key Staff Loss"/"Regulatory Change", "Budget Overrun"/"Supply Delay"
  • VQ-03: Element Visibility (5/6) — Points well-sized with jitter, but clustering in shared cells causes some visual clutter
  • VQ-04: Color Accessibility (2/4) — Green-to-red risk zone gradient is problematic for red-green colorblind viewers; category colors are more distinguishable
  • VQ-05: Layout & Canvas (3/4) — Good proportions overall, legend positioned slightly far from plot area
  • VQ-06: Axis Labels & Title (1/2) — "Likelihood" and "Impact" are descriptive but no units (ordinal scale, so limited applicability)

Design Excellence (13/20)

  • DE-01: Aesthetic Sophistication (5/8) — Custom color palette for zones and categories, semi-transparent score labels add depth, domain-appropriate design above defaults
  • DE-02: Visual Refinement (4/6) — Panel grid removed, white cell borders, clean theme_minimal base; good refinement
  • DE-03: Data Storytelling (4/6) — Color zones create inherent visual hierarchy; categories add dimensionality; viewer can quickly identify high-risk items

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) — Correct 5×5 grid heatmap risk matrix
  • SC-02: Required Features (4/4) — Color-coded zones, labeled markers with jitter, zone legend, white grid lines, descriptive axis labels
  • SC-03: Data Mapping (3/3) — X=Likelihood, Y=Impact correctly mapped with proper ordinal labels
  • SC-04: Title & Legend (3/3) — Title format "heatmap-risk-matrix · lets-plot · pyplots.ai" correct, both legends match data

Data Quality (14/15)

  • DQ-01: Feature Coverage (5/6) — 15 risks spread across Low/Medium/High zones with 3 categories; no risks in Critical zone (score 20-25 cells)
  • DQ-02: Realistic Context (5/5) — Authentic enterprise risk management scenario with realistic risk names
  • DQ-03: Appropriate Scale (4/4) — 1-5 ordinal scale with sensible risk placements

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) — Clean imports → data → plot → save flow
  • CQ-02: Reproducibility (2/2) — np.random.seed(42) set for jitter
  • CQ-03: Clean Imports (2/2) — All imports used (numpy, pandas, lets_plot)
  • CQ-04: Code Elegance (2/2) — Appropriate complexity, clean layered construction
  • CQ-05: Output & API (1/1) — Saves as plot.png with scale=3

Library Mastery (6/10)

  • LM-01: Idiomatic Usage (4/5) — Good ggplot grammar with layered geoms, manual scales, and theme customization
  • LM-02: Distinctive Features (2/5) — HTML export is lets-plot specific, but no truly distinctive features used (e.g., tooltips, interactive layers, livemap)

Score Caps Applied

  • None

Strengths

  • Perfect spec compliance — all required features implemented correctly
  • Excellent data with realistic enterprise risk management context and 15 well-distributed risk items
  • Clean, well-structured code with proper seed and KISS pattern
  • Semi-transparent score labels in cells add visual depth without clutter
  • Good use of layered ggplot grammar (tiles + score text + points + labels)

Weaknesses

  • Multiple risk label pairs overlap where risks share the same cell, making text hard to read
  • Green-to-red color gradient is not colorblind-safe — consider using a sequential palette (e.g., yellow-orange-red) or viridis-derived colors
  • No risks placed in Critical zone cells (scores 20-25), reducing feature coverage
  • Library mastery could be improved with lets-plot-specific features

Issues Found

  1. VQ-02 LOW: Label overlaps at cells (2,5), (3,4), and (4,3) where multiple risks share the same position
    • Fix: Increase jitter range, use smaller font for labels, or implement smarter label positioning to avoid collisions
  2. VQ-04 LOW: Green-red risk zone gradient is not colorblind-accessible
    • Fix: Use a sequential palette that avoids pure green/red (e.g., "#ffffcc"→"#fd8d3c"→"#e31a1c" or a viridis-based scheme)
  3. DQ-01 MINOR: No risks in Critical zone (scores 20-25)
    • Fix: Place at least one risk in the Critical zone to demonstrate all severity levels
  4. LM-02 LOW: Generic library usage without lets-plot-distinctive features
    • Fix: Consider using lets-plot-specific features like geom_label() or interactive tooltips

AI Feedback for Next Attempt

Fix the label overlap issue by increasing jitter range (e.g., ±0.35) and reducing label font size. Replace the green-red color scale with a colorblind-safe sequential palette. Add at least one risk item in the Critical zone (likelihood 4-5, impact 5). Consider using lets-plot-specific features to improve library mastery score.

Verdict: REJECTED

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

🔧 Repair Attempt 1/3

Applied fixes based on AI review feedback.

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


🤖 impl-repair

@claude
Copy link
Contributor

claude bot commented Mar 17, 2026

AI Review - Attempt 2/3

Image Description

The plot displays a 5×5 risk assessment matrix with "Likelihood" (Rare to Almost Certain) on the x-axis and "Impact" (Negligible to Catastrophic) on the y-axis. Background tiles are colored by risk zone: blue (Low, scores 1-4), yellow (Medium, scores 5-9), orange (High, scores 10-16), and dark red (Critical, scores 20-25). Each cell shows its risk score as a semi-transparent number. Fifteen risk items are plotted as colored dots (blue=Technical, purple=Financial, orange=Operational) with bold labels above them. Two legends appear on the right: "Risk Level" and "Category". The title reads "heatmap-risk-matrix · lets-plot · pyplots.ai". White borders separate the cells. Some label crowding is visible in the Moderate row ("Regulatory Change" and "Budget Overrun" labels overlap at cell boundaries) and in the Catastrophic row.

Score: 80/100

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

Visual Quality (23/30)

  • VQ-01: Text Legibility (7/8) - Font sizes explicitly set for title, axes, legend. Risk item labels (size=8) slightly small but readable.
  • VQ-02: No Overlap (4/6) - Label crowding in Moderate row ("Regulatory Change"/"Budget Overrun" overlap at cell boundary); Catastrophic row labels also tight
  • VQ-03: Element Visibility (5/6) - Points and tiles clearly visible; semi-transparent score numbers are subtle but readable
  • VQ-04: Color Accessibility (3/4) - Blue-yellow-orange-red zone palette is better than green-red for colorblind users; category colors distinguishable
  • VQ-05: Layout & Canvas (3/4) - Good canvas utilization, legend positioned well on right side
  • VQ-06: Axis Labels & Title (1/2) - "Likelihood" and "Impact" are descriptive but lack units (ordinal scale makes units less applicable)

Design Excellence (12/20)

  • DE-01: Aesthetic Sophistication (5/8) - Custom colorblind-safe zone palette, custom category colors, white tile borders, semi-transparent score overlays — clearly above defaults but not publication-level
  • DE-02: Visual Refinement (4/6) - Panel grid removed, white cell borders, minimal theme with generous whitespace
  • DE-03: Data Storytelling (3/6) - Zone colors create some visual hierarchy, but all risk markers are same size regardless of severity — no emphasis on critical risks

Spec Compliance (14/15)

  • SC-01: Plot Type (5/5) - Correct 5×5 heatmap risk matrix
  • SC-02: Required Features (3/4) - Spec says "green-yellow-orange-red" gradient but uses blue for Low (colorblind adaptation). All other features present: descriptive axis labels, jittered markers, zone legend, grid lines.
  • SC-03: Data Mapping (3/3) - Likelihood on X, Impact on Y, all 5 levels present
  • SC-04: Title & Legend (3/3) - Correct format "heatmap-risk-matrix · lets-plot · pyplots.ai", both Risk Level and Category legends present

Data Quality (14/15)

  • DQ-01: Feature Coverage (5/6) - 15 risks across all zones (Low to Critical), 3 categories, good distribution — but no risks in bottom-right cells
  • DQ-02: Realistic Context (5/5) - Real-world IT/project risk management scenario, neutral topic
  • DQ-03: Appropriate Scale (4/4) - Risk ratings 1-5 appropriate for standard risk matrices

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) - Clean linear flow: imports → data → plot → save
  • CQ-02: Reproducibility (2/2) - np.random.seed(42) set
  • CQ-03: Clean Imports (2/2) - All imports used (numpy, pandas, lets_plot)
  • CQ-04: Code Elegance (2/2) - Well-structured jitter logic, appropriate complexity
  • CQ-05: Output & API (1/1) - Saves plot.png with scale=3, also exports HTML

Library Mastery (7/10)

  • LM-01: Idiomatic Usage (4/5) - Good use of ggplot grammar: geom_tile + geom_text + geom_point layering, scale_fill_manual, theme customization
  • LM-02: Distinctive Features (3/5) - Uses layer_tooltips() for interactive hover info (distinctive lets-plot feature), HTML export

Score Caps Applied

  • None

Strengths

  • Excellent data quality with realistic risk management context and good distribution across zones
  • Smart jitter system to handle overlapping risks in same cell
  • Interactive tooltips via layer_tooltips() showcase lets-plot's distinctive capabilities
  • Clean, well-organized code with proper seed and linear structure
  • Colorblind-friendly zone palette adaptation (blue instead of green)

Weaknesses

  • Label overlap/crowding when risk items are in adjacent cells (especially Moderate row)
  • All risk markers are identical size — no visual emphasis on critical vs low risks
  • Risk item label font size (size=8) could be slightly larger for better readability
  • No visual storytelling emphasis — critical risks don't stand out beyond zone color

Issues Found

  1. VQ-02 MODERATE: Risk name labels overlap at cell boundaries when risks are in adjacent cells
    • Fix: Increase jitter range, reduce label font size slightly, or use check_overlap if available
  2. DE-03 LOW: All risk markers are same size — no visual hierarchy among individual risks
    • Fix: Map marker size to risk score (likelihood × impact) so critical risks appear larger and more prominent
  3. DE-01 MODERATE: Design is above defaults but needs more polish to reach publication quality
    • Fix: Consider adding a subtle subtitle with risk context, or use marker outlines to add depth

AI Feedback for Next Attempt

To reach 90+: (1) Fix label overlap by adjusting jitter offsets or label placement strategy for adjacent-cell risks. (2) Create visual hierarchy by mapping marker size to risk score — critical risks should visually dominate. (3) Consider increasing risk label font size from 8 to 9-10. (4) Add a subtle subtitle or annotation to enhance data storytelling. These changes would push Design Excellence and Visual Quality scores significantly higher.

Verdict: REJECTED

@github-actions github-actions bot added the ai-rejected Quality not OK, triggers update label Mar 17, 2026
@github-actions github-actions bot added ai-attempt-2 Second repair attempt and removed ai-rejected Quality not OK, triggers update labels Mar 17, 2026
@github-actions
Copy link
Contributor Author

🔧 Repair Attempt 2/3

Applied fixes based on AI review feedback.

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


🤖 impl-repair

@claude
Copy link
Contributor

claude bot commented Mar 17, 2026

AI Review - Attempt 3/3

Image Description

The plot displays a 5×5 risk assessment matrix with Likelihood (Rare to Almost Certain) on the x-axis and Impact (Negligible to Catastrophic) on the y-axis. Cells are color-coded: teal/green for Low risk, yellow for Medium, orange for High, and red for Critical zones. Each cell shows its risk score (1–25) in large semi-transparent text. 15 risk items are plotted as colored circular markers (blue=Technical, purple=Financial, orange=Operational) with bold text labels. Marker size scales with risk score. The title reads "heatmap-risk-matrix · lets-plot · pyplots.ai" with a subtitle explaining the scoring formula. Two legends appear on the right: Risk Level and Category. White grid lines delineate cells. Some labels near edges (e.g., "Cyber Attack") are slightly clipped by the plot boundary.

Score: 82/100

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

Visual Quality (23/30)

  • VQ-01: Text Legibility (7/8) - All font sizes explicitly set (title 24, subtitle 15, axis title 20, axis text 15, legend 17/14). Tick text at 15pt is slightly below the 16pt guideline but still readable.
  • VQ-02: No Overlap (4/6) - "Cyber Attack" label is clipped at the right edge of the grid. Some labels are tight near cell boundaries. Most are readable but not perfect.
  • VQ-03: Element Visibility (5/6) - Markers are visible with size scaling. Good alpha (0.92). Smaller markers for low-risk items could be slightly larger.
  • VQ-04: Color Accessibility (3/4) - Zone colors (teal, yellow, orange, red) are distinguishable. Category colors (blue, purple, orange) are reasonable but purple-blue distinction could be challenging for some.
  • VQ-05: Layout & Canvas (3/4) - Good proportions with coord_fixed. Some empty space on the right side beyond the legends. Plot fills reasonable canvas area.
  • VQ-06: Axis Labels & Title (1/2) - "Likelihood" and "Impact" are descriptive but lack the rating scale context (no units applicable, but could say "Likelihood (1-5 Rating)").

Design Excellence (13/20)

  • DE-01: Aesthetic Sophistication (5/8) - Custom zone palette (teal-yellow-orange-red), custom category colors, intentional size hierarchy, informative subtitle. Above defaults but not publication-level.
  • DE-02: Visual Refinement (4/6) - Panel grid removed, theme_minimal applied, white cell borders provide clean separation. Good whitespace management.
  • DE-03: Data Storytelling (4/6) - Visual hierarchy through marker size scaling with risk score, color-coded zones, and score numbers in background create clear focal points on high-risk areas (top-right). Viewer's eye is drawn to critical risks.

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) - Correct 5×5 grid heatmap with risk items as markers.
  • SC-02: Required Features (4/4) - Green-yellow-orange-red gradient, descriptive axis labels, labeled markers with jitter, zone legend with risk levels (Low 1-4, Medium 5-9, High 10-16, Critical 20-25).
  • SC-03: Data Mapping (3/3) - Likelihood on X, Impact on Y, all 15 risk items visible.
  • SC-04: Title & Legend (3/3) - Title "heatmap-risk-matrix · lets-plot · pyplots.ai" correct. Risk Level and Category legends with correct labels.

Data Quality (14/15)

  • DQ-01: Feature Coverage (5/6) - 15 risks across all four zones. Multiple categories represented. Good spread but could include more items in Low zone for balance.
  • DQ-02: Realistic Context (5/5) - Real-world IT/business risk scenarios (Server Outage, Data Breach, Budget Overrun, etc.). Neutral and comprehensible.
  • DQ-03: Appropriate Scale (4/4) - Likelihood and impact ratings are sensible for each risk item.

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) - Clean imports → data → plot → save structure, no functions/classes.
  • CQ-02: Reproducibility (2/2) - np.random.seed(42) set.
  • CQ-03: Clean Imports (2/2) - All imports used (numpy, pandas, lets_plot).
  • CQ-04: Code Elegance (2/2) - Smart jitter with offset patterns, checkerboard nudge for labels. Appropriate complexity.
  • CQ-05: Output & API (1/1) - Saves as plot.png with ggsave(scale=3), also generates HTML.

Library Mastery (7/10)

  • LM-01: Idiomatic Usage (4/5) - Good ggplot grammar usage: aes, geom_tile, geom_point, geom_text, scale_*, theme. Split label layers are slightly non-idiomatic.
  • LM-02: Distinctive Features (3/5) - Uses layer_tooltips() for interactive hover information (distinctive lets-plot feature) and HTML export. Good use of lets-plot's interactive capabilities.

Score Caps Applied

  • None

Strengths

  • Perfect spec compliance with all required features implemented (5×5 grid, zones, labeled markers, jitter, legend)
  • Excellent data quality with realistic, neutral business/IT risk scenarios
  • Smart jitter and checkerboard nudge pattern to minimize label overlap
  • Good use of lets-plot distinctive features (tooltips, HTML export)
  • Clean, well-structured code with appropriate complexity

Weaknesses

  • "Cyber Attack" label is clipped at the right edge of the plot area
  • Axis tick text at 15pt is slightly below the 16pt guideline
  • Some empty canvas space to the right of legends
  • Purple-blue category color distinction could be improved for accessibility

Issues Found

  1. VQ-02 MINOR: "Cyber Attack" label extends beyond grid boundary at top-right
    • Fix: Increase x-axis upper limit slightly or shorten label
  2. VQ-05 MINOR: Some wasted space to the right of the legend area
    • Fix: Adjust ggsize or legend positioning
  3. DE-01 MODERATE: Good design but could reach higher with more typographic refinement
    • Fix: Consider subtitle styling, more intentional color harmony

AI Feedback for Next Attempt

Solid implementation at attempt 3. The risk matrix is well-constructed with good spec compliance, realistic data, and clean code. The main areas preventing a 90+ score are minor label clipping at edges and the gap between "good" and "publication-ready" design. The lets-plot tooltips add genuine interactive value.

Verdict: REJECTED

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-attempt-2 Second repair attempt quality:80 Quality score 80/100

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants