|
1 | 1 | """ pyplots.ai |
2 | 2 | box-basic: Basic Box Plot |
3 | | -Library: pygal 3.1.0 | Python 3.13.11 |
4 | | -Quality: 91/100 | Created: 2025-12-23 |
| 3 | +Library: pygal 3.1.0 | Python 3.14 |
| 4 | +Quality: /100 | Updated: 2026-02-14 |
5 | 5 | """ |
6 | 6 |
|
7 | 7 | import numpy as np |
|
20 | 20 | "HR": np.random.normal(58000, 8000, 100), |
21 | 21 | } |
22 | 22 |
|
23 | | -# Add some outliers to demonstrate box plot features |
| 23 | +# Add outliers to demonstrate box plot features |
24 | 24 | data["Engineering"] = np.append(data["Engineering"], [130000, 135000, 40000]) |
25 | 25 | data["Sales"] = np.append(data["Sales"], [120000, 25000]) |
26 | 26 |
|
27 | | -# Custom style using PyPlots colors |
| 27 | +# Custom style scaled for 4800x2700 canvas |
28 | 28 | custom_style = Style( |
29 | 29 | background="white", |
30 | 30 | plot_background="white", |
31 | 31 | foreground="#333333", |
32 | 32 | foreground_strong="#333333", |
33 | | - foreground_subtle="#666666", |
34 | | - colors=("#306998", "#FFD43B", "#4CAF50", "#FF5722", "#9C27B0"), |
35 | | - title_font_size=60, |
36 | | - label_font_size=40, |
37 | | - major_label_font_size=36, |
38 | | - legend_font_size=36, |
| 33 | + foreground_subtle="#cccccc", |
| 34 | + colors=("#306998", "#E69F00", "#009E73", "#D55E00", "#8B5CF6"), |
| 35 | + title_font_size=72, |
| 36 | + label_font_size=44, |
| 37 | + major_label_font_size=40, |
| 38 | + legend_font_size=44, |
39 | 39 | value_font_size=32, |
| 40 | + opacity=0.9, |
| 41 | + opacity_hover=1.0, |
40 | 42 | ) |
41 | 43 |
|
42 | 44 | # Create box chart |
43 | 45 | chart = pygal.Box( |
44 | 46 | width=4800, |
45 | 47 | height=2700, |
46 | 48 | style=custom_style, |
47 | | - title="box-basic · pygal · pyplots.ai", |
| 49 | + title="box-basic \u00b7 pygal \u00b7 pyplots.ai", |
48 | 50 | x_title="Department", |
49 | 51 | y_title="Salary ($)", |
50 | 52 | show_legend=True, |
51 | 53 | legend_at_bottom=True, |
52 | | - legend_box_size=24, |
| 54 | + legend_at_bottom_columns=5, |
| 55 | + legend_box_size=36, |
| 56 | + truncate_legend=-1, |
| 57 | + truncate_label=-1, |
53 | 58 | show_y_guides=True, |
54 | 59 | show_x_guides=False, |
55 | | - margin=50, |
| 60 | + margin=60, |
| 61 | + spacing=40, |
56 | 62 | box_mode="tukey", |
| 63 | + dots_size=8, |
57 | 64 | ) |
58 | 65 |
|
59 | 66 | # Add data for each category |
|
0 commit comments