Proportional Symbols¶
ProportionalLayer draws circles whose area is
proportional to a data column. Circle centroids are computed from polygon
centroids automatically.
from mappyng import Map, BasemapLayer, ProportionalLayer
m = Map(gdf, width=800, height="auto")
m.add(BasemapLayer())
m.add(ProportionalLayer(
gdf_pts,
column="population",
fill="#e31a1c",
fill_opacity=0.7,
stroke="#ffffff",
stroke_width=0.5,
reference_value=1_000_000,
reference_radius=20,
legend={
"title": "Population",
"orientation": "nested",
"values": [100_000, 500_000, 1_000_000],
"number_format": "space",
"leader_opacity": 0.5,
},
))
Layer parameters¶
Key |
Default |
Description |
|---|---|---|
|
required |
Numeric column for circle sizing. |
|
|
Circle fill color. |
|
0.7 |
Circle fill opacity 0-1. |
|
|
Circle stroke color. |
|
0.5 |
Circle stroke width (SVG px). |
|
30 |
Maximum circle radius in auto-scale mode (SVG px). |
|
|
Data value that maps exactly to |
|
|
Radius in SVG px for |
|
|
Render on zoom viewport. |
|
|
Render on cartouche viewports. |
|
|
Legend sub-config dict. See tables below. |
Legend parameters (legend sub-dict)¶
Shared fields: see the choropleth guide (shared fields table under “Legend parameters”).
Proportional-specific fields¶
Key |
Default |
Description |
|---|---|---|
|
|
Layout: |
|
|
Explicit list of data values to show. Auto-generated if None. |
|
4 |
Number of auto-generated legend values. |
|
0 |
Decimal places for value labels. |
|
|
Thousands separator: |
|
|
Override circle fill color in the legend. Uses layer fill if None. |
|
0.7 |
Legend circle fill opacity. |
|
|
Legend circle stroke color. |
|
0.8 |
Legend circle stroke width (SVG px). |
|
|
Fixed gap between circles in horizontal mode (SVG px). Auto if None. |
|
4 |
Gap between circle edge and label (SVG px). |
|
|
Leader line color (nested mode). |
|
0.5 |
Leader line stroke width (SVG px). |
|
|
Leader line SVG |
|
0.6 |
Leader line opacity 0-1. |