Title and legend
Legends¶
Every layer that colours, sizes, widens or raises by data gets a legend block; one card holds them all.
Quick reference¶
| Utility | Does | Example |
|---|---|---|
legend-nonelegend-<tl\|tc\|tr\|ml\|mr\|bl\|bc\|br>legend-below |
Hide the legend or choose where it sits: a corner, an edge centre, or below the map | legend-nonelegend-brlegend-tc |
Options¶
legend= takes what the legend says; legend_style= takes how it looks and where it sits.
legend= key |
Does |
|---|---|
title |
the heading; defaults to the column or expression |
fmt |
a number format for class edges, such as "{:,.0f}" or "{:.0%}" |
labels |
your own text, one per class (two or three ticks for scheme-linear) |
note |
a small line under the block |
style |
"list" (default) or "bar", a compact bar with the edges under it |
counts |
False hides the class counts |
A bar legend¶
Anywhere on the map¶
Eight places inside the map, plus below. The legend- utility picks a place in the style string; legend_style= can also set it, and wins.
Glass¶
Keys added for you¶
| Layer uses | Key |
|---|---|
size-[...] |
three nested circles with their values |
width-[...] |
three line samples |
extrude-[...] |
a height note: what height shows and how tall the tallest is |
scheme-linear |
a gradient with low, middle and high ticks |
Your own Lonboard map¶
kh.legend(gdf, style, title="Population") returns the legend card as HTML to place yourself.


