Vector Overlays (extra_vectors)
The extra_vectors parameter is one of the most powerful features of geoplot-themes. It allows you to overlay an infinite number of vector layers (shapefiles) onto your base map.
What makes this special is that it uses ggnewscale to ensure that every layer has its own independent legend.
Usage
You pass a list of dictionaries to extra_vectors. Each dictionary represents a single spatial layer.
python
extra_vectors = [
{
"data": "C:/data/swamp.shp",
"name": "Wetlands",
"fill": "#2d5a27",
"alpha": 0.6
},
{
"data": "C:/data/river.shp",
"name": "Rivers",
"color": "#1f78b4",
"linewidth": 1.2
}
]Dictionary Keys
| Key | Type | Description |
|---|---|---|
data | string | Absolute or relative path to the vector file (.shp, .geojson). |
name | string | The label that will appear in the legend for this layer. |
color | string (hex) | The outline or line color (e.g. #1f78b4). Use "NA" for no outline. |
fill | string (hex) | The fill color for polygons. Use "NA" for hollow polygons. |
alpha | float | Transparency from 0.0 (invisible) to 1.0 (opaque). |
linewidth | float | Thickness of the lines or polygon borders. |
