Charts Module
datachart.charts
Module containing the charts.
The charts module contains the functions that create the figures, one per
chart type, grouped by the question they answer. Every function takes the data
as a list of records, keyword settings, and an optional style dictionary, and
returns a matplotlib figure.
Charts by Family
One page per chart: the function and its parameters, the shape of its data, the keys style takes, and the constant each parameter accepts. Pick the chart by the question it answers; the chart guides show each one on real data.
Trends and Comparisons
| Chart | Shows | Data | Style | Guide |
|---|---|---|---|---|
| LineChart | A value along an ordered axis, one line per series. | LineDataPointAttrs |
LineStyleAttrs |
Line Chart |
| StackedAreaChart | Parts of a total along an ordered axis, filled on top of each other. | LineDataPointAttrs |
StackedAreaStyleAttrs |
Stacked Area Chart |
| BumpChart | Rank over time, one line per series. | LineDataPointAttrs |
BumpStyleAttrs |
Bump Chart |
| BarChart | A value per category as bars; series grouped, stacked, or overlaid. | BarDataPointAttrs |
BarStyleAttrs |
Bar Chart |
| PyramidChart | Two series as horizontal bars mirrored around a shared category axis. | BarDataPointAttrs |
BarStyleAttrs |
Pyramid Chart |
| RadialChart | Series on polar axes, as a radar line, an area, bars, or a histogram. | RadialDataPointAttrs |
LineStyleAttrs, BarStyleAttrs, HistStyleAttrs, ScatterStyleAttrs |
Radial Chart |
| CalendarHeatmap | One colored cell per day, weeks as columns and weekdays as rows. | CalendarHeatmapDataAttrs |
CalendarHeatmapStyleAttrs |
Calendar Heatmap |
| GanttChart | A schedule: one bar per task from its start to its end over a date axis. | GanttTaskAttrs |
GanttStyleAttrs |
Gantt Chart |
| DumbbellChart | Two values per category, a dot at each and a connector between them. | DumbbellRecordAttrs |
DumbbellStyleAttrs |
Dumbbell Chart |
Distributions
| Chart | Shows | Data | Style | Guide |
|---|---|---|---|---|
| Histogram | The distribution of one numeric variable, binned. | HistDataPointAttrs |
HistStyleAttrs |
Histogram |
| BoxPlot | Median, quartiles, whiskers, and outliers per group. | BoxDataPointAttrs |
BoxStyleAttrs |
Box Plot |
| ViolinPlot | The density profile of each group's distribution. | ViolinDataPointAttrs |
ViolinStyleAttrs |
Violin Plot |
| SwarmPlot | Every observation as a point, spread within its group. | SwarmDataPointAttrs |
SwarmStyleAttrs |
Swarm Plot |
| RaincloudPlot | A half violin, the raw points, and a box per group. | RaincloudDataPointAttrs |
RaincloudStyleAttrs |
Raincloud Plot |
| RidgelinePlot | One density ridge per group, stacked and partly overlapping. | RidgelineDataPointAttrs |
RidgelineStyleAttrs |
Ridgeline Plot |
Relationships
| Chart | Shows | Data | Style | Guide |
|---|---|---|---|---|
| ScatterChart | One point per observation, placed by two numeric variables. | ScatterDataPointAttrs |
ScatterStyleAttrs |
Scatter Chart |
| Heatmap | A two-dimensional matrix as colored cells. | HeatmapDataAttrs |
HeatmapStyleAttrs |
Heatmap |
| ContourChart | A surface sampled on a grid, as iso-lines or filled bands. | ContourDataAttrs |
ContourStyleAttrs |
Contour Chart |
| HexbinChart | Point density on the plane, as colored hexagons. | HexbinDataAttrs |
HexbinStyleAttrs |
Hexbin Chart |
| ParallelCoords | Each record as a polyline across one axis per dimension. | ParallelCoordsDataPointAttrs |
ParallelCoordsStyleAttrs |
Parallel Coordinates |
| NetworkChart | Nodes joined by edges, placed by a layout. | NetworkSingleChartAttrs |
NetworkStyleAttrs |
Network Chart |
| ScatterMatrix | A scatter chart for every pair of dimensions, distributions on the diagonal. | ScatterMatrixDataPointAttrs |
StyleAttrs |
Scatter Matrix |
Flows
| Chart | Shows | Data | Style | Guide |
|---|---|---|---|---|
| SankeyChart | Weighted flows between categories, as ribbons between node columns. | SankeySingleChartAttrs |
SankeyStyleAttrs |
Sankey Chart |
Part of a Whole
| Chart | Shows | Data | Style | Guide |
|---|---|---|---|---|
| Treemap | Part-of-whole data as nested rectangles sized by value. | TreemapSingleChartAttrs |
TreemapStyleAttrs |
Treemap |