Altair
Declarative statistical visualization library for Python based on Vega-Lite grammar. Altair features: alt.Chart() with mark_bar/mark_line/mark_point/mark_area, encode() for channel mappings (x, y, color, size, tooltip), transform_filter()/transform_aggregate()/transform_calculate() for data transforms, selection/condition for interactive filtering, facet()/vconcat()/hconcat()/layer() for composition, alt.data_transformers for large dataset handling, save() to HTML/SVG/PNG, Jupyter widget rendering, and theme support. Grammar of Graphics approach — describe what to show, not how to draw it. Best for exploratory data analysis and interactive dashboards in Jupyter.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Local visualization library — no network calls during chart generation. Exported HTML embeds data in JSON — do not export sensitive data to shared HTML files. Vega-Lite CDN loaded at render time in HTML output.
⚡ Reliability
Best When
Exploratory data analysis in Jupyter notebooks or generating interactive HTML reports — Altair's declarative Grammar of Graphics approach produces publication-quality interactive charts with minimal code.
Avoid When
You need real-time streaming, production web dashboards, or datasets over 50K rows without VegaFusion.
Use Cases
- • Agent data exploration — import altair as alt; chart = alt.Chart(df).mark_point().encode(x='sepal_length:Q', y='petal_length:Q', color='species:N', tooltip=['species', 'sepal_length']).interactive() — scatter plot with tooltips and pan/zoom; agent data analyst generates interactive visualizations for Jupyter notebooks with one declarative expression
- • Agent time series dashboard — chart = alt.Chart(df).mark_line().encode(x='date:T', y='value:Q', color='metric:N').properties(width=600).interactive() — multi-series time series with zoom; agent monitoring dashboard renders interactive metric trends in Jupyter or HTML export
- • Agent filtered dashboard — selector = alt.selection_point(fields=['category']); chart = alt.Chart(df).mark_bar().encode(x='category:N', y='count():Q', color=alt.condition(selector, 'category:N', alt.value('lightgray'))).add_params(selector) — click-to-filter bar chart; agent analysis dashboard lets user filter categories by clicking bars
- • Agent small multiples — chart = alt.Chart(df).mark_bar().encode(x='month:O', y='sales:Q').facet(facet='region:N', columns=3) — faceted small multiples grid by region; agent sales analysis generates per-region breakdowns automatically with uniform axis scales
- • Agent report HTML export — chart.save('report.html') — standalone HTML file with embedded Vega-Lite spec; agent generates self-contained interactive chart HTML for stakeholder reports; no server required for viewing; chart.save('chart.png') for static PNG export
Not For
- • Production web apps — Altair generates Vega-Lite specs for Jupyter/HTML; for production dashboards use Dash (Plotly) or Observable
- • Real-time streaming data — Altair is batch/static; for streaming dashboards use Bokeh server or Streamlit
- • Large datasets (>5000 rows in notebook) — Altair embeds data in JSON spec by default; use alt.data_transformers.enable('vegafusion') for large data or aggregate before charting
Interface
Authentication
No auth — local visualization library.
Pricing
Altair is BSD licensed. Free for all use.
Agent Metadata
Known Gotchas
- ⚠ MaxRowsError for datasets over 5000 rows — alt.Chart(large_df) raises MaxRowsError by default; agent code must either aggregate data first, sample, or enable: alt.data_transformers.enable('vegafusion') for large data support; never suppress with alt.data_transformers.disable_max_rows() in production as it embeds MB of JSON in HTML
- ⚠ Type shorthand required in encode — x='value' fails; must use x='value:Q' (quantitative), x='category:N' (nominal), x='date:T' (temporal), x='rank:O' (ordinal); agent code generating chart specs must always include type shorthand or use alt.X('value', type='quantitative')
- ⚠ save() to PNG requires vl-convert-python — chart.save('out.png') raises ImportError without vl-convert-python package; agent code generating PNG for reports must pip install vl-convert-python separately; HTML export works without additional packages
- ⚠ Interactive selections need add_params not deprecated add_selection — Altair 5.x replaced add_selection() with add_params(); agent code from Altair 4.x tutorials using add_selection() raises AttributeError; use selector = alt.selection_point(); chart.add_params(selector)
- ⚠ Data must be DataFrame or URL not list of dicts for large data — alt.Chart([{'x': 1}]) works for small data; large list of dicts converts to pandas internally with overhead; agent code should pass pandas DataFrame directly for best performance and to avoid type inference surprises
- ⚠ Composition requires matching data — alt.layer(chart1, chart2) requires both charts use same data or explicit data in each layer; agent code layering charts with different datasets must specify data in each sub-chart; vconcat/hconcat can have different data per panel
Alternatives
Full Evaluation Report
Comprehensive deep-dive: security analysis, reliability audit, agent experience review, cost modeling, competitive positioning, and improvement roadmap for Altair.
AI-powered analysis · PDF + markdown · Delivered within 30 minutes
Package Brief
Quick verdict, integration guide, cost projections, gotchas with workarounds, and alternatives comparison.
Delivered within 10 minutes
Score Monitoring
Get alerted when this package's AF, security, or reliability scores change significantly. Stay ahead of regressions.
Continuous monitoring
Scores are editorial opinions as of 2026-03-06.