diff --git a/plots/scatter-basic/implementations/altair.py b/plots/scatter-basic/implementations/altair.py new file mode 100644 index 0000000000..37066ca852 --- /dev/null +++ b/plots/scatter-basic/implementations/altair.py @@ -0,0 +1,30 @@ +""" +scatter-basic: Basic Scatter Plot +Library: altair +""" + +import altair as alt +import numpy as np +import pandas as pd + + +# Data +np.random.seed(42) +x = np.random.randn(100) * 2 + 10 +y = x * 0.8 + np.random.randn(100) * 2 + +df = pd.DataFrame({"x": x, "y": y}) + +# Create chart +chart = ( + alt.Chart(df) + .mark_point(filled=True, size=100, opacity=0.7, color="#306998") + .encode(x=alt.X("x:Q", title="X Value"), y=alt.Y("y:Q", title="Y Value"), tooltip=["x:Q", "y:Q"]) + .properties(width=1600, height=900, title="Basic Scatter Plot") + .configure_axis(labelFontSize=16, titleFontSize=20, grid=True, gridOpacity=0.3) + .configure_title(fontSize=20) +) + +# Save as PNG and HTML +chart.save("plot.png", scale_factor=3.0) +chart.save("plot.html") diff --git a/plots/scatter-basic/metadata/altair.yaml b/plots/scatter-basic/metadata/altair.yaml new file mode 100644 index 0000000000..4a296b61d5 --- /dev/null +++ b/plots/scatter-basic/metadata/altair.yaml @@ -0,0 +1,18 @@ +# Per-library metadata for altair implementation of scatter-basic +# Auto-generated by impl-generate.yml + +library: altair +specification_id: scatter-basic + +preview_url: https://storage.googleapis.com/pyplots-images/plots/scatter-basic/altair/plot.png +preview_html: https://storage.googleapis.com/pyplots-images/plots/scatter-basic/altair/plot.html + +current: + version: 0 + generated_at: 2025-12-11T22:54:30Z + generated_by: claude-opus-4-5-20251101 + workflow_run: 20150014835 + issue: 611 + quality_score: 88 + +history: []