|
1 | 1 | """ pyplots.ai |
2 | 2 | raincloud-basic: Basic Raincloud Plot |
3 | 3 | 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 |
5 | 5 | """ |
6 | 6 |
|
7 | 7 | import numpy as np |
|
26 | 26 | group_colors = ["#306998", "#FFD43B", "#4CAF50"] |
27 | 27 |
|
28 | 28 | # Custom style for 4800x2700 px canvas - scaled up for visibility |
| 29 | +# Using very subtle grid lines (low alpha via lighter color) |
29 | 30 | custom_style = Style( |
30 | 31 | background="white", |
31 | 32 | plot_background="white", |
32 | 33 | foreground="#333333", |
33 | 34 | foreground_strong="#333333", |
34 | 35 | foreground_subtle="#999999", |
35 | | - guide_stroke_color="#cccccc", |
| 36 | + guide_stroke_color="#e8e8e8", # Very light guide lines for subtle grid |
36 | 37 | colors=tuple(group_colors * 3) + ("#222222",) * 30, |
37 | 38 | title_font_size=96, |
38 | 39 | label_font_size=60, |
|
55 | 56 | x_title="Treatment Group", |
56 | 57 | y_title="Reaction Time (ms)", |
57 | 58 | show_legend=False, |
| 59 | + legend_at_bottom=False, |
| 60 | + legend_box_size=0, |
58 | 61 | stroke=True, |
59 | 62 | fill=True, |
60 | 63 | dots_size=0, |
|
124 | 127 | whisker_high = float(min(values.max(), q3 + 1.5 * iqr)) |
125 | 128 | box_data.append((center_x, median, q1, q3, whisker_low, whisker_high, group_colors[i])) |
126 | 129 |
|
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 |
128 | 131 | 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) |
130 | 133 |
|
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 |
132 | 135 | 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) |
134 | 137 |
|
135 | 138 | # Add box plots - vertical boxes centered at each group |
136 | 139 | # Significantly increased line weights for 4800x2700 canvas |
|
146 | 149 | (center_x + box_width, q1), |
147 | 150 | (center_x - box_width, q1), |
148 | 151 | ] |
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}) |
150 | 153 |
|
151 | 154 | # Median line (horizontal line within box) - thickest for emphasis |
152 | 155 | 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}) |
154 | 157 |
|
155 | 158 | # Whiskers (vertical lines from box to caps) |
156 | 159 | whisker_bottom = [(center_x, whisker_low), (center_x, q1)] |
157 | 160 | 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}) |
160 | 163 |
|
161 | 164 | # Whisker caps (horizontal lines at ends) |
162 | 165 | cap_bottom = [(center_x - cap_width, whisker_low), (center_x + cap_width, whisker_low)] |
163 | 166 | 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}) |
166 | 169 |
|
167 | 170 | # X-axis labels for treatment groups |
168 | 171 | chart.x_labels = [ |
|
0 commit comments