Altair is a declarative statistical visualization library for Python built on Vega-Lite, enabling rapid creation of interactive, publication-quality charts with minimal code. Unlike imperative plotting libraries, Altair uses a grammar of graphics approach where you specify what relationships to visualize rather than how to draw them—the library handles rendering details automatically. A key insight: Altair's power lies in its composability—simple chart elements combine through layering, concatenation, and faceting to create sophisticated multi-view dashboards without manual layout calculations.
What This Cheat Sheet Covers
This topic spans 20 focused tables and 162 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Chart Creation and Mark Types
| Method | Example | Description |
|---|---|---|
alt.Chart(df) | Creates base chart object from pandas DataFrame or URL; all visualizations start here | |
chart.mark_point() | Renders scatter plot with circular points; supports filled, size, and shape properties | |
chart.mark_line() | Draws connected line chart; use point=True to show both line and points | |
chart.mark_bar() | Creates bar chart; automatically stacks when color encoding present | |
chart.mark_area() | Fills area between line and baseline; ideal for stacked area charts | |
chart.mark_circle() | Similar to mark_point but always renders circles regardless of shape encoding | |
chart.mark_rect() | Draws rectangles; commonly used for heatmaps with x/y encoding | |
chart.mark_text() | Displays text labels; requires text encoding channel for values |