Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Cartogram 3D

Signature

sp.cartogram3d(title, labels=None, values=None, lats=None, lons=None, *, map="world", region="", variant="dorling", orientation3d="iso", scene="default", theme="none", zone=None, max_points=None, bg_color="#1a1a2e", width=1200, height=650, x_label="", y_label="", z_label="", **kwargs) -> Chart

Aliases: sp.build_cartogram3d_chart(), sp.cartogram_3d(), sp.cartogram3d_chart().

Description

sp.cartogram3d() is the 3D twin of sp.cartogram(): both cartogram variants share the same 3D form, selected with the same variant keyword. The 2D chart’s whole point is relaxing circles or squares apart so they stop overlapping on a flat page; in 3D, value is read from column height instead, so that relaxation has nothing left to solve — every point stands at its own raw lats/lons position (or region centroid), unrelaxed.

Variants

VariantAliasesUses3D form
dorlingcircles, basic, default, bubble_relaxlabels, values, lats, lonsOne column per point at its raw position, height following its value.
demerssquares, grid_relax, boxeslabels, values, lats, lonsThe same columns as dorling; the 2D chart’s square-packing styling has no separate 3D form.

Data

Either lats/lons (raw points) or labels (region codes); values sets each column’s height.

3D planes

The viewpoint is independent from the variant: orientation3d picks the initial camera plane and applies to every variant; 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.

3D scenes

scene swaps the environment the columns are drawn in and applies to every variant and 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.

Themes

theme restyles the whole canvas (colour grade and glow) and applies to every variant, scene and plane.

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.