Skip to content

Commit 754098e

Browse files
feat(styles): enhance sizing and font settings for visualizations
- Update chart size and title font size in Altair - Adjust text sizes for axes and titles in Bokeh - Standardize sizing and font settings for Highcharts - Improve text and element sizes in Matplotlib - Refine layout and sizing for Plotly - Enhance figure size and text settings in Plotnine - Update styling for Pygal and Seaborn to ensure visibility
1 parent 37c2709 commit 754098e

15 files changed

Lines changed: 747 additions & 280 deletions

prompts/default-style-guide.md

Lines changed: 54 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
# PyPlots.ai Default Style Guide
22

3-
Minimal style requirements for consistent visualizations.
3+
Style requirements for consistent visualizations at **4800 × 2700 px**.
44

5-
## Color Palette
5+
## Important: Large Canvas Size
66

7-
Use colors in this order for data series:
7+
pyplots renders at **4800 × 2700 px** (much larger than standard plots). All element sizes must be scaled for visibility!
88

9-
| # | Name | Hex |
10-
|----|---------------|-----------|
11-
| 1 | Python Blue | #306998 |
12-
| 2 | Python Yellow | #FFD43B |
13-
| 3 | Signal Red | #DC2626 |
14-
| 4 | Teal Green | #059669 |
15-
| 5 | Violet | #8B5CF6 |
16-
| 6 | Orange | #F97316 |
9+
**Common Mistake:** Using default/standard sizes results in tiny, hard-to-see elements.
10+
11+
---
1712

1813
## Dimensions
1914

@@ -22,27 +17,59 @@ Use colors in this order for data series:
2217
| Image Size | 4800 × 2700 px |
2318
| Aspect Ratio | 16:9 |
2419

25-
## Typography & Lines (Recommended)
20+
---
21+
22+
## Color Palette
23+
24+
Primary colors (always use these first):
25+
26+
| # | Name | Hex |
27+
|----|---------------|-----------|
28+
| 1 | Python Blue | #306998 |
29+
| 2 | Python Yellow | #FFD43B |
30+
31+
For additional colors: AI chooses appropriate, colorblind-safe colors.
32+
33+
---
34+
35+
## Visual Sizing Principles
36+
37+
Since we render at 4800 × 2700 px, elements must be **visually prominent**:
38+
39+
### Text
40+
- **Title**: Large and clearly readable
41+
- **Axis labels**: Prominent, not tiny
42+
- **Tick labels**: Readable at full image size
43+
- **Legend**: Easy to read
44+
45+
### Data Elements
46+
- **Points/Markers**: Clearly visible, not tiny dots
47+
- **Lines**: Thick enough to see clearly
48+
- **Bars**: With subtle edges for definition
49+
50+
### General Rules
51+
- Elements should be **~3-4x larger** than standard defaults
52+
- When in doubt, make it bigger
53+
- Test: Would this be readable on a 4K monitor?
54+
55+
---
56+
57+
## Grid
2658

27-
These values typically work well at 4800 × 2700 px:
59+
- Subtle, not dominant
60+
- Low opacity (around 30%)
61+
- Should enhance readability, not distract
2862

29-
| Element | Size |
30-
|------------------|--------|
31-
| Title | 20pt |
32-
| Axis Labels | 20pt |
33-
| Tick Labels | 16pt |
34-
| Legend | 16pt |
35-
| Annotations | 14pt |
36-
| Line Width | 2 px |
37-
| Marker Size | 4 px |
63+
---
3864

3965
## AI Discretion
4066

41-
The following are left to AI judgment based on the specific visualization:
67+
The AI decides based on the specific library and visualization:
4268

69+
- Exact sizes and parameters (library-specific)
4370
- Font family
44-
- Grid style and visibility
45-
- Tick configuration
46-
- Legend placement and styling
71+
- Grid style (on/off, dashed/solid)
72+
- Legend placement
73+
- Additional colors beyond the primary two
4774

48-
Focus on **clarity and readability** for the specific plot type.
75+
**Priority:** Clarity and readability at 4800 × 2700 px.

prompts/library/altair.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@ import altair as alt
99
## Create Chart
1010

1111
```python
12-
chart = alt.Chart(df).mark_point().encode(
12+
chart = alt.Chart(df).mark_point(size=150).encode( # size ~3-4x default
1313
x='col_x:Q',
1414
y='col_y:Q'
1515
).properties(
1616
width=1600,
1717
height=900,
18-
title=title
18+
title=alt.Title(title, fontSize=28)
19+
).configure_axis(
20+
labelFontSize=18,
21+
titleFontSize=22
1922
)
2023
```
2124

prompts/library/bokeh.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,19 @@ export_png(p, filename='plot.png')
5555

5656
**Note**: Requires `selenium` and WebDriver for PNG export.
5757

58-
## Styling
58+
## Sizing for 4800×2700 px
5959

6060
```python
61-
p.xaxis.axis_label = x_label
62-
p.yaxis.axis_label = y_label
63-
# Grid: AI discretion
61+
# Text sizes
62+
p.title.text_font_size = '28pt'
63+
p.xaxis.axis_label_text_font_size = '22pt'
64+
p.yaxis.axis_label_text_font_size = '22pt'
65+
p.xaxis.major_label_text_font_size = '18pt'
66+
p.yaxis.major_label_text_font_size = '18pt'
67+
68+
# Element sizes
69+
p.scatter(..., size=15) # ~3-4x default
70+
p.line(..., line_width=3)
6471
```
6572

6673
## Output File

prompts/library/highcharts.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,32 @@ driver.quit()
111111
Path(temp_path).unlink() # Clean up temp file
112112
```
113113

114-
## Chart Size
114+
## Sizing for 4800×2700 px
115115

116116
```python
117-
# Target: 4800 × 2700 px (see default-style-guide.md)
118117
chart.options.chart = {
119-
'type': 'column', # or 'bar', 'scatter', etc.
118+
'type': 'column',
120119
'width': 4800,
121120
'height': 2700,
122121
'backgroundColor': '#ffffff'
123122
}
123+
124+
# Text sizes
125+
chart.options.title = {'text': title, 'style': {'fontSize': '28px'}}
126+
chart.options.x_axis = {
127+
'title': {'text': x_label, 'style': {'fontSize': '22px'}},
128+
'labels': {'style': {'fontSize': '18px'}}
129+
}
130+
chart.options.y_axis = {
131+
'title': {'text': y_label, 'style': {'fontSize': '22px'}},
132+
'labels': {'style': {'fontSize': '18px'}}
133+
}
134+
135+
# Marker sizes (in plotOptions)
136+
chart.options.plot_options = {
137+
'scatter': {'marker': {'radius': 8}}, # ~3-4x default
138+
'line': {'lineWidth': 3}
139+
}
124140
```
125141

126142
## Output File

prompts/library/letsplot.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,23 @@ plot = (
1919
)
2020
```
2121

22-
## Figure Size
22+
## Figure Size & Sizing for 4800×2700 px
2323

2424
```python
25-
# Target: 4800 × 2700 px (see default-style-guide.md)
26-
plot = plot + ggsize(1600, 900) # Base size, scaled 3x on export
25+
# Base size (scaled 3x on export = 4800 × 2700 px)
26+
plot = plot + ggsize(1600, 900)
27+
28+
# Text and element sizes
29+
plot = plot + theme(
30+
axis_title=element_text(size=20),
31+
axis_text=element_text(size=16),
32+
plot_title=element_text(size=24),
33+
legend_text=element_text(size=16)
34+
)
35+
36+
# Element sizes in geoms
37+
+ geom_point(size=4) # ~3-4x default
38+
+ geom_line(size=1.5) # line width
2739
```
2840

2941
## Save (PNG)

prompts/library/matplotlib.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,32 @@ plt.scatter(x, y)
3333
plt.savefig('plot.png', dpi=300, bbox_inches='tight')
3434
```
3535

36+
## Sizing for 4800×2700 px
37+
38+
```python
39+
# Text sizes
40+
ax.set_title(title, fontsize=24)
41+
ax.set_xlabel(x_label, fontsize=20)
42+
ax.set_ylabel(y_label, fontsize=20)
43+
ax.tick_params(axis='both', labelsize=16)
44+
ax.legend(fontsize=16)
45+
46+
# Element sizes
47+
ax.scatter(x, y, s=200) # s=150-300 (not s=50!)
48+
ax.plot(x, y, linewidth=3) # linewidth=2-4 (not 1!)
49+
50+
# Grid
51+
ax.grid(True, alpha=0.3, linestyle='--')
52+
```
53+
3654
## Styling
3755

3856
```python
39-
ax.set_xlabel(x_label)
40-
ax.set_ylabel(y_label)
41-
ax.set_title(title)
42-
ax.legend() # if needed
57+
ax.set_xlabel(x_label, fontsize=20)
58+
ax.set_ylabel(y_label, fontsize=20)
59+
ax.set_title(title, fontsize=24)
60+
ax.legend(fontsize=16) # if needed
4361
plt.tight_layout()
44-
# Grid: AI discretion
4562
```
4663

4764
## API Compatibility (3.9+)

prompts/library/plotly.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,19 @@ fig.add_trace(go.Scatter(x=x, y=y))
1919
fig = px.scatter(df, x='col_x', y='col_y')
2020
```
2121

22-
## Layout
22+
## Layout & Sizing for 4800×2700 px
2323

2424
```python
2525
fig.update_layout(
26-
title=title,
27-
xaxis_title=x_label,
28-
yaxis_title=y_label,
29-
template='plotly_white', # Clean template
26+
title=dict(text=title, font=dict(size=28)),
27+
xaxis=dict(title=dict(text=x_label, font=dict(size=22)), tickfont=dict(size=18)),
28+
yaxis=dict(title=dict(text=y_label, font=dict(size=22)), tickfont=dict(size=18)),
29+
template='plotly_white',
3030
)
31+
32+
# Marker/line sizes
33+
fig.update_traces(marker=dict(size=12)) # ~3-4x default
34+
fig.update_traces(line=dict(width=3))
3135
```
3236

3337
## Save (PNG)

prompts/library/plotnine.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,21 @@ plot = (
2222
)
2323
```
2424

25-
## Figure Size
25+
## Figure Size & Sizing for 4800×2700 px
2626

2727
```python
28-
plot = plot + theme(figure_size=(16, 9))
28+
plot = plot + theme(
29+
figure_size=(16, 9),
30+
text=element_text(size=14), # Base text
31+
axis_title=element_text(size=20), # Axis labels
32+
axis_text=element_text(size=16), # Tick labels
33+
plot_title=element_text(size=24), # Title
34+
legend_text=element_text(size=16)
35+
)
36+
37+
# Element sizes in geoms
38+
+ geom_point(size=4) # ~3-4x default
39+
+ geom_line(size=1.5) # line width
2940
```
3041

3142
## Save (PNG)

prompts/library/pygal.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ chart.render_to_file('plot.svg')
5252
chart.render_to_png('plot.png')
5353
```
5454

55-
## Styling
55+
## Sizing for 4800×2700 px
5656

5757
```python
5858
custom_style = Style(
@@ -61,7 +61,13 @@ custom_style = Style(
6161
foreground='#333',
6262
foreground_strong='#333',
6363
foreground_subtle='#666',
64-
colors=('#3498db', '#2ecc71', '#e74c3c', '#9b59b6')
64+
colors=('#306998', '#FFD43B'), # pyplots primary colors
65+
title_font_size=28,
66+
label_font_size=18,
67+
major_label_font_size=16,
68+
legend_font_size=16,
69+
value_font_size=14,
70+
stroke_width=3 # line width
6571
)
6672

6773
chart = pygal.Bar(style=custom_style)

prompts/library/seaborn.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,23 @@ fig = g.figure
3131
plt.savefig('plot.png', dpi=300, bbox_inches='tight')
3232
```
3333

34+
## Sizing for 4800×2700 px
35+
36+
```python
37+
# Text sizes (seaborn uses matplotlib underneath)
38+
ax.set_title(title, fontsize=24)
39+
ax.set_xlabel(x_label, fontsize=20)
40+
ax.set_ylabel(y_label, fontsize=20)
41+
ax.tick_params(axis='both', labelsize=16)
42+
43+
# Or use sns.set_context for global scaling
44+
sns.set_context("talk", font_scale=1.2)
45+
46+
# Element sizes in seaborn functions
47+
sns.scatterplot(..., s=200) # marker size
48+
sns.lineplot(..., linewidth=3) # line width
49+
```
50+
3451
## API Compatibility (0.14+)
3552

3653
```python

0 commit comments

Comments
 (0)