Skip to content

Commit f99f09f

Browse files
feat(altair): implement area-basic (#375)
## Summary Implements `area-basic` for **altair** library. **Parent Issue:** #201 **Sub-Issue:** #219 **Base Branch:** `plot/area-basic` **Attempt:** 1/3 ## Implementation - `plots/altair/area/area-basic/default.py` ## Details - Uses `mark_area()` with 0.5 opacity and Python Blue color (#306998) - Overlays `mark_line()` for visible line on top of area - Configures axis with subtle grid (opacity 0.3) - 1600x900 base size with 3x scale factor for 4800x2700 output - Font sizes: title 20pt, axis labels 20pt, tick labels 16pt Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
1 parent 8864341 commit f99f09f

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
area-basic: Basic Area Chart
3+
Library: altair
4+
"""
5+
6+
import altair as alt
7+
import pandas as pd
8+
9+
10+
# Data
11+
data = pd.DataFrame({"month": [1, 2, 3, 4, 5, 6], "sales": [100, 150, 130, 180, 200, 220]})
12+
13+
# Create chart with area and line
14+
area = (
15+
alt.Chart(data)
16+
.mark_area(opacity=0.5, color="#306998")
17+
.encode(
18+
x=alt.X("month:Q", title="Month", axis=alt.Axis(labelFontSize=16, titleFontSize=20)),
19+
y=alt.Y("sales:Q", title="Sales", axis=alt.Axis(labelFontSize=16, titleFontSize=20)),
20+
)
21+
)
22+
23+
line = alt.Chart(data).mark_line(color="#306998", strokeWidth=2).encode(x="month:Q", y="sales:Q")
24+
25+
chart = (
26+
(area + line)
27+
.properties(width=1600, height=900, title=alt.Title("Basic Area Chart", fontSize=20))
28+
.configure_axis(grid=True, gridOpacity=0.3)
29+
)
30+
31+
# Save
32+
chart.save("plot.png", scale_factor=3.0)

0 commit comments

Comments
 (0)