Skip to content

Styling data

Circles by size

Proportional symbols: the area of each circle grows with the value.

Quick reference

Utility Does Example
size-<pixels>
size-[<expr>]
size-max-<pixels>
Point radius in pixels, or circles sized by data (area grows with the value) size-6
size-2.5
size-[pop]

Sized by data

size-[pop] scales the circle's area, not its radius, so a value twice as big looks twice as big. The largest circle has a radius of size-max pixels (default 24). Values above zero never shrink below one pixel; zero and negative values are not drawn, with a warning. The legend adds three nested circles.

centres here is states.assign(geometry=states.representative_point()): circles need points, and representative_point() always falls inside its polygon.

kh.map(centres, "theme-paper size-[pop] size-max-34 fill-rose-500/60 stroke-white stroke-1",
       title="Population by state")

Colour and size together

Colour and size can show two different columns:

FUELS = {"Coal": "zinc-400", "Oil": "amber-700", "Gas": "orange-400", "Nuclear": "fuchsia-400",
         "Hydro": "sky-400", "Wind": "teal-300", "Solar": "yellow-300"}
kh.map(plants, "theme-midnight fill-[primary_fuel] size-[capacity_mw] size-max-16 stroke-transparent",
       colors=FUELS, order=list(FUELS), legend={"title": "Main fuel"}, title="Power plants by fuel")

Points of one size

size-6 draws every point with a 6-pixel radius.