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

Signature

sp.cartogram(title, labels=None, values=None, *, lats=None, lons=None, variant="dorling", map="world", region=None, **kwargs) -> Chart

Aliases: sp.cartogram, sp.cartogram_chart, sp.dorling_cartogram, sp.geo_cartogram, sp.proportional_cartogram, sp.relaxed_map, sp.build_cartogram

Description

sp.cartogram() replaces true geography with a glyph sized by values at every lats/lons point, then runs a real iterative relaxation so overlapping glyphs push apart while a weak pull keeps each one near its true position — the classic technique named after cartographer Danny Dorling, used for things like election-result or population maps where area itself (not just color) should carry the number. A dashed line appears wherever a glyph had to move far from where it really sits, the standard way a real Dorling cartogram shows its own distortion honestly. map / region restrict which registered region set’s outlines draw as faint background context, read live from the same register/inventory system the rest of the framework uses.

Variants

Region Sets

Parameters


Returns

Chart — object with .html property and .show() method.


The default: a circle per point, radius scaled by sqrt(value) so area reads honestly, fill color repeating the same value on a sequential ramp for a redundant, easy-to-scan encoding. Circles start at their true projected position and relax apart over 180 iterations of pairwise repulsion balanced against a weak pull back home — real physics-style relaxation, not a packed layout that ignores geography.

Variant "dorling"Aliases "dorling" / "circles" / "basic" / "default" / "bubble_relax"Returns Chart
Preview

The same relaxation with square glyphs instead of circles — a second named cartogram style, after cartographer Steve Demers, useful whenever a grid-like reading suits the data better than a cluster of circles.

Variant "demers"Aliases "demers" / "squares" / "grid_relax" / "boxes"Returns Chart
Preview