Skip to content

Commit 6b79a25

Browse files
feat(pygal): implement raincloud-basic (#1954)
## Implementation: `raincloud-basic` - pygal Implements the **pygal** version of `raincloud-basic`. **File:** `plots/raincloud-basic/implementations/pygal.py` --- :robot: *[impl-generate workflow](https://github.com/MarkusNeusinger/pyplots/actions/runs/20501866165)* --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 3956ea9 commit 6b79a25

2 files changed

Lines changed: 27 additions & 28 deletions

File tree

plots/raincloud-basic/implementations/pygal.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
""" pyplots.ai
22
raincloud-basic: Basic Raincloud Plot
33
Library: pygal 3.1.0 | Python 3.13.11
4-
Quality: 78/100 | Created: 2025-12-25
4+
Quality: 91/100 | Created: 2025-12-25
55
"""
66

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

2828
# Custom style for 4800x2700 px canvas - scaled up for visibility
29+
# Using very subtle grid lines (low alpha via lighter color)
2930
custom_style = Style(
3031
background="white",
3132
plot_background="white",
3233
foreground="#333333",
3334
foreground_strong="#333333",
3435
foreground_subtle="#999999",
35-
guide_stroke_color="#cccccc",
36+
guide_stroke_color="#e8e8e8", # Very light guide lines for subtle grid
3637
colors=tuple(group_colors * 3) + ("#222222",) * 30,
3738
title_font_size=96,
3839
label_font_size=60,
@@ -55,6 +56,8 @@
5556
x_title="Treatment Group",
5657
y_title="Reaction Time (ms)",
5758
show_legend=False,
59+
legend_at_bottom=False,
60+
legend_box_size=0,
5861
stroke=True,
5962
fill=True,
6063
dots_size=0,
@@ -124,13 +127,13 @@
124127
whisker_high = float(min(values.max(), q3 + 1.5 * iqr))
125128
box_data.append((center_x, median, q1, q3, whisker_low, whisker_high, group_colors[i]))
126129

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

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

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

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

155158
# Whiskers (vertical lines from box to caps)
156159
whisker_bottom = [(center_x, whisker_low), (center_x, q1)]
157160
whisker_top = [(center_x, q3), (center_x, whisker_high)]
158-
chart.add(None, whisker_bottom, stroke=True, fill=False, show_dots=False, stroke_style={"width": 14})
159-
chart.add(None, whisker_top, stroke=True, fill=False, show_dots=False, stroke_style={"width": 14})
161+
chart.add("", whisker_bottom, stroke=True, fill=False, show_dots=False, stroke_style={"width": 14})
162+
chart.add("", whisker_top, stroke=True, fill=False, show_dots=False, stroke_style={"width": 14})
160163

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

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

0 commit comments

Comments
 (0)