Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions plots/raincloud-basic/implementations/pygal.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
""" pyplots.ai
raincloud-basic: Basic Raincloud Plot
Library: pygal 3.1.0 | Python 3.13.11
Quality: 78/100 | Created: 2025-12-25
Quality: 91/100 | Created: 2025-12-25
"""

import numpy as np
Expand All @@ -26,13 +26,14 @@
group_colors = ["#306998", "#FFD43B", "#4CAF50"]

# Custom style for 4800x2700 px canvas - scaled up for visibility
# Using very subtle grid lines (low alpha via lighter color)
custom_style = Style(
background="white",
plot_background="white",
foreground="#333333",
foreground_strong="#333333",
foreground_subtle="#999999",
guide_stroke_color="#cccccc",
guide_stroke_color="#e8e8e8", # Very light guide lines for subtle grid
colors=tuple(group_colors * 3) + ("#222222",) * 30,
title_font_size=96,
label_font_size=60,
Expand All @@ -55,6 +56,8 @@
x_title="Treatment Group",
y_title="Reaction Time (ms)",
show_legend=False,
legend_at_bottom=False,
legend_box_size=0,
stroke=True,
fill=True,
dots_size=0,
Expand Down Expand Up @@ -124,13 +127,13 @@
whisker_high = float(min(values.max(), q3 + 1.5 * iqr))
box_data.append((center_x, median, q1, q3, whisker_low, whisker_high, group_colors[i]))

# Add clouds (half-violins) - no labels since y-axis labels already show groups
# Add clouds (half-violins) - using empty string for label to suppress legend
for _category, cloud_points, _color in cloud_data:
chart.add(None, cloud_points, stroke=True, fill=True)
chart.add("", cloud_points, stroke=True, fill=True)

# Add rain points - increased dots_size for visibility on 4800x2700 canvas
# Add rain points - increased dots_size for better visibility on 4800x2700 canvas
for _category, rain_points, _color in rain_data:
chart.add(None, rain_points, stroke=False, fill=False, dots_size=24)
chart.add("", rain_points, stroke=False, fill=False, dots_size=32)

# Add box plots - vertical boxes centered at each group
# Significantly increased line weights for 4800x2700 canvas
Expand All @@ -146,23 +149,23 @@
(center_x + box_width, q1),
(center_x - box_width, q1),
]
chart.add(None, quartile_box, stroke=True, fill=False, show_dots=False, stroke_style={"width": 20})
chart.add("", quartile_box, stroke=True, fill=False, show_dots=False, stroke_style={"width": 20})

# Median line (horizontal line within box) - thickest for emphasis
median_line = [(center_x - box_width * 1.3, median), (center_x + box_width * 1.3, median)]
chart.add(None, median_line, stroke=True, fill=False, show_dots=False, stroke_style={"width": 28})
chart.add("", median_line, stroke=True, fill=False, show_dots=False, stroke_style={"width": 28})

# Whiskers (vertical lines from box to caps)
whisker_bottom = [(center_x, whisker_low), (center_x, q1)]
whisker_top = [(center_x, q3), (center_x, whisker_high)]
chart.add(None, whisker_bottom, stroke=True, fill=False, show_dots=False, stroke_style={"width": 14})
chart.add(None, whisker_top, stroke=True, fill=False, show_dots=False, stroke_style={"width": 14})
chart.add("", whisker_bottom, stroke=True, fill=False, show_dots=False, stroke_style={"width": 14})
chart.add("", whisker_top, stroke=True, fill=False, show_dots=False, stroke_style={"width": 14})

# Whisker caps (horizontal lines at ends)
cap_bottom = [(center_x - cap_width, whisker_low), (center_x + cap_width, whisker_low)]
cap_top = [(center_x - cap_width, whisker_high), (center_x + cap_width, whisker_high)]
chart.add(None, cap_bottom, stroke=True, fill=False, show_dots=False, stroke_style={"width": 14})
chart.add(None, cap_top, stroke=True, fill=False, show_dots=False, stroke_style={"width": 14})
chart.add("", cap_bottom, stroke=True, fill=False, show_dots=False, stroke_style={"width": 14})
chart.add("", cap_top, stroke=True, fill=False, show_dots=False, stroke_style={"width": 14})

# X-axis labels for treatment groups
chart.x_labels = [
Expand Down
28 changes: 12 additions & 16 deletions plots/raincloud-basic/metadata/pygal.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
library: pygal
specification_id: raincloud-basic
created: '2025-12-25T07:14:50Z'
updated: '2025-12-25T07:36:01Z'
created: '2025-12-25T08:21:24Z'
updated: '2025-12-25T08:23:33Z'
generated_by: claude-opus-4-5-20251101
workflow_run: 20500987018
workflow_run: 20501866165
issue: 0
python_version: 3.13.11
library_version: 3.1.0
preview_url: https://storage.googleapis.com/pyplots-images/plots/raincloud-basic/pygal/plot.png
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/raincloud-basic/pygal/plot_thumb.png
preview_html: https://storage.googleapis.com/pyplots-images/plots/raincloud-basic/pygal/plot.html
quality_score: 78
quality_score: 91
review:
strengths:
- Correct raincloud layout with cloud on right, boxplot centered, rain on left (vertical
orientation per spec)
- Excellent use of pygal XY chart to build complex composite visualization from
scratch
- Colorblind-safe palette with good contrast between groups
- Realistic clinical trial reaction time scenario
- Manual KDE implementation with proper Silverman bandwidth
- Proper box plot components including whisker caps
- Excellent manual implementation of raincloud plot using pygal XY chart primitives
- Clean KDE computation using Silverman rule for bandwidth estimation
- Correct vertical raincloud layout with cloud on right, rain on left as per spec
- Well-scaled font sizes for the 4800x2700 canvas
- Colorblind-safe color palette
- Realistic reaction time data with appropriate outliers showing distribution differences
weaknesses:
- Legend displays despite show_legend=False setting - use chart configuration to
fully suppress
- Rain dots could be slightly larger for better visibility at 4800x2700 resolution
- Grid lines are present but could be more subtle (lower alpha)
- Box plot elements could be slightly thicker/more visible relative to the half-violin
- No interactive tooltips leveraging pygal SVG interactivity capabilities