Skip to content

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.

Chart Shows Data Style Guide
LineChart A value along an ordered axis, one line per series. LineRecordAttrs LineStyleAttrs Line Chart
StackedAreaChart Parts of a total along an ordered axis, filled on top of each other. LineRecordAttrs StackedAreaStyleAttrs Stacked Area Chart
BumpChart Rank over time, one line per series. LineRecordAttrs BumpStyleAttrs Bump Chart
BarChart A value per category as bars; series grouped, stacked, or overlaid. BarRecordAttrs BarStyleAttrs Bar Chart
PyramidChart Two series as horizontal bars mirrored around a shared category axis. BarRecordAttrs BarStyleAttrs Pyramid Chart
RadialChart Series on polar axes, as a radar line, an area, bars, or a histogram. RadialRecordAttrs 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. GanttTaskRecordAttrs 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. HistRecordAttrs HistStyleAttrs Histogram
BoxPlot Median, quartiles, whiskers, and outliers per group. BoxRecordAttrs BoxStyleAttrs Box Plot
ViolinPlot The density profile of each group's distribution. ViolinRecordAttrs ViolinStyleAttrs Violin Plot
SwarmPlot Every observation as a point, spread within its group. SwarmRecordAttrs SwarmStyleAttrs Swarm Plot
RaincloudPlot A half violin, the raw points, and a box per group. RaincloudRecordAttrs RaincloudStyleAttrs Raincloud Plot
RidgelinePlot One density ridge per group, stacked and partly overlapping. RidgelineRecordAttrs RidgelineStyleAttrs Ridgeline Plot

Relationships

Chart Shows Data Style Guide
ScatterChart One point per observation, placed by two numeric variables. ScatterRecordAttrs 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. ParallelCoordsRecordAttrs 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. ScatterMatrixRecordAttrs StyleAttrs Scatter Matrix
ImageChart A picture in data coordinates, under or over the other charts. ImageDataAttrs ImageStyleAttrs Image Chart
BasemapChart Coastlines, land, borders, lakes, rivers and roads under a chart of longitude and latitude. BasemapDataAttrs BasemapStyleAttrs Basemap Chart

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