Bar Chart 3D
Signature
sp.bar3d(title, labels=None, values=None, *, variant="basic", series=None, series_names=None, orientation3d="iso", color_hex=0x6366F1, palette=None, bg_color="#1a1a2e", width=900, height=560, x_label="", y_label="", z_label="", **kwargs) -> Chart
Aliases: sp.build_bar3d_chart(), sp.bar_3d(), sp.bar3d_chart(), sp.bar3d_family(), sp.bars3d().
Description
sp.bar3d() renders the SeraPlot bar family as extruded prisms on an interactive 3D canvas. It is the 3D twin of sp.bar(): every one of the 17 bar variants has a 3D form, selected with the same variant= keyword and fed with the same data fields. Layouts come from shared, family-agnostic strategies (linear, grouped, stacked, radial, spiral, box-and-whisker), so geometry is never hand-written per variant.
Variants
| Variant | Aliases | Uses | 3D form |
|---|---|---|---|
basic | — | labels, values | One extruded column per category along the X axis; height encodes the value. |
horizontal | h, hbar | labels, values | Bars lie flat along the X axis, one row per category; length encodes the value. |
grouped | group | labels, series, series_names | Series side by side in depth: one row of columns per series, categories along X. |
stacked | stack | labels, series, series_names | Series stacked into a single column per category; each segment keeps its series colour. |
relative | rel | labels, series, series_names | Stacked columns normalised to 100 %: every column reaches the same height, segments show the share. |
grouped_stacked | groupstack, grouped-stacked | labels, series, offset_groups | Stack groups placed side by side in depth, each stack built from its own series segments. |
marimekko | mekko, mosaic | labels, series, widths | Columns whose footprint width follows widths, stacked segments encode each series share. |
pictogram | icon | labels, values, units_per_icon | Every icon becomes a small block; blocks pile up in columns of max_icons_per_column. |
multicategory | multi, hierarchical | labels, values, super_categories | Columns grouped under their super_categories, with an extra gap between two groups. |
circular | circular_basic, radial_bar, polar_bar | labels, values | Columns stand on a ring, one per category; height encodes the value. |
circular_grouped | radial_grouped, circular_groups | labels, values, color_groups | The same ring split into angular arcs by color_groups, one colour per group. |
population_pyramid | pyramid, age_pyramid | labels, series, series_names | Two back-to-back rows of columns, one per series (male / female), age groups along X. |
diverging | signed, delta, bidirectional | labels, values | Columns rise above or sink below the floor with the sign of the value; with series, positive and negative segments stack on each side. |
distribution | bar_box, boxbar, bar_boxplot | labels, series | For each sample a slim column spans the whiskers and a wider box spans the interquartile range. |
spiral | spiral_bar, nautilus, radial_spiral, growth_spiral | labels, values | Columns follow an outward spiral, one per index — made for long time series. |
hedgehog | flow_fan, quill, spike_flow, relocation_fan | labels, values | Signed spikes around a ring: positive values rise, negative values sink. |
radial_flow | capital_flow, hierarchical_radial, sankey_radial, flow_arc | labels, values, super_categories | A ring split into arcs by super_categories, columns grouped under their parent. |
3D planes
The viewpoint is independent from the variant: orientation3d (aliases tilt3d, rotate3d) picks the initial camera plane and applies to every variant. The plane can also be switched afterwards with .orient3d(mode), and the view always stays draggable.
orientation3d="iso" — Isometric three-quarter view (default).orientation3d="horizontal" — Side-on view, almost at floor level.orientation3d="vertical" — Top-down view from above.orientation3d="front" — Front elevation, nearly flat.chart = sp.bar3d("Sales", variant="grouped", labels=labels, series=series, series_names=names, orientation3d="vertical")
chart = chart.orient3d("front")
3D scenes
The scene is a second independent axis: scene swaps the environment the bars are drawn in and applies to every variant too. Every scene works with every plane.
scene="default" — Each series keeps its own categorical palette color, rendered as shaded 3D bars on a flat grid.scene="terrain" — The data is resampled onto a dense grid and rendered as hundreds of thin colormap-colored columns, forming a continuous mountain-of-bars terrain.scene="tower" — The data is resampled onto a dense field of round skyscraper-like towers instead of boxes, for a city-skyline reading of magnitude.scene="radial" — The data is resampled onto a dense polar grid of rings and wedges radiating from the center, like a 3D radar/sonar sweep of the value field.scene="podium" — The data is resampled onto a dense grid and quantized into stepped terrace levels, like a rice-terrace contour map, to read value bands at a glance.chart = sp.bar3d("Sales", variant="spiral", labels=years, values=counts, scene="terrain", orientation3d="vertical")
Themes
theme restyles the whole canvas (colour grade and glow) and applies to every variant, scene and plane. Sorting follows the 2D chart too: sort_order="desc" reorders the columns of every single-series variant.
theme="deluxe"theme="prism"theme="aurora"theme="inferno"theme="frost"theme="glow"theme="glass"theme="neon"theme="cosmic"Auto-scaling zone
The 3D zone (floor, walls, axes and camera) scales to the elements: its length, width and height follow the extents of the drawn blocks, a minimum floor depth keeps single rows readable, wide scenes are drawn flatter and the camera frames the whole box. The axis ticks read the real data range. Pass zone=[x, y, z] to force the proportions of the box instead; the longest side is normalised to 1.
Parameters
Returns
Chart object with an .html property and a .show() method.