Bar Charts
Signature
sp.bar(title, labels=None, values=None, *, variant="basic", series=None, series_names=None, theme="none", **kwargs) -> Chart
Aliases: sp.bar_chart(), sp.bars(), sp.bar_unified(), sp.bars_unified(), sp.bar_family().
Description
sp.bar() is the unified entry point for the SeraPlot bar-chart family. It renders standalone Rust-generated HTML/SVG charts. The variant keyword selects the renderer, and shared chart options are applied by the common chart pipeline.
The default renderer is a vertical categorical bar chart. The same API also covers every bar variant registered in Rust.
Variants
Data
labels are category labels for bar variants. Single-series variants use values. Multi-series variants use series, where each inner list is one series, and series_names supplies legend names.
When series is missing but series_names is provided, values is interpreted as a flattened matrix split by len(labels): the first category-length block is the first series, the next block is the second series, and so on.
Parameters
Themes
Returns
Chart object with an .html property and a .show() method.
Parameters
Horizontal bars — better for long category names. Alias: "h".
Multiple series side-by-side per category. Alias: "group".
Series stacked vertically — shows part-to-whole within each category. Alias: "stack".
100% stacked bars — every column fills from 0 to 100%, showing each series as a share of the total. Alias: "rel".
Groups of stacked sub-bars per category. offset_groups assigns a stack-group name to each series.
Variable-width stacked bars (mosaic plot). widths encodes one dimension, stacked segments encode share. Aliases: "mekko", "mosaic".
A bar made of repeated icons. Each icon represents units_per_icon units. Alias: "icon".
Two-level hierarchical x axis. super_categories groups adjacent bars under a bracket label. Alias: "multi".
Bars arranged radially around a center, length proportional to value. Pass show_values=True for a value at each bar’s tip, gridlines=True for labeled concentric rings. Aliases: "circular_basic", "radial_bar", "polar_bar".
Circular bars split into groups via color_groups, with an extra gap between groups. Same show_values/gridlines options as circular. Aliases: "radial_grouped", "circular_groups".
Two horizontal bar sets mirrored left/right around a shared category axis, from the first two entries of series. Aliases: "pyramid", "age_pyramid".
Horizontal bars extending left or right from a zero line, colored by sign — color_high (default red, 0xF43F5E) for positive, color_low (default blue, 0x636EFA) for negative — value printed inside the bar (white) when it’s wide enough or just outside otherwise. Aliases: "signed", "delta", "bidirectional". Pass series (with category_labels) instead of values for a stacked multi-series diverging chart — each series stacks on its own side of zero by its own sign, one color per series from palette, with a real legend naming each series (not a generic “positive/negative” label). Optional error_low/error_high (one entry per bar) draw a whisker; optional overlay_line (+ overlay_line_label) draws a connected line across the bars, matching each row by position. The value label is controlled by show_values (bool) like every other bar variant — it defaults to True here so existing charts keep their look, unlike other variants where it defaults to False.
Bar + boxplot fusion: a semi-transparent bar up to each category’s mean, with a real box (Q1/median/Q3, whiskers) overlaid on top showing the distribution behind that mean — pass series as one raw sample array per category (same shape as boxplot’s grouped input) instead of single aggregate values. Aliases: "bar_box", "boxbar", "bar_boxplot".