Getting Started
Welcome to geoplot-themes! This package bridges the gap between Python's data processing capabilities and R's unparalleled cartographic layout engine (ggplot2 + patchwork).
Installation
- Make sure you have R installed and added to your system
PATH. - Install the package using
uvorpip:
bash
uv add geoplot-themes
# or
pip install geoplot-themesThe package will automatically install the required R dependencies (terra, sf, ggplot2, ggspatial, ggnewscale) on its first run.
Basic Usage
Here is how to generate a publication-ready erosion map with a base raster:
python
import geoplot_themes as gpt
gpt.plot_map_r(
raster_data="erosion_probability_2014.tif",
theme="natgeo_minimalist",
colormap="elevation",
title="Erosion Probability (2014)",
output_path="my_map.png"
)Advanced Vectors
You can stack multiple shapefiles over your raster, complete with independent legends, using the extra_vectors parameter:
python
extra_vectors = [
{
"data": "swamp.shp",
"name": "Wetlands",
"fill": "#2d5a27",
"alpha": 0.6
},
{
"data": "river.shp",
"name": "Rivers",
"color": "#1f78b4",
"linewidth": 1.2
}
]
gpt.plot_map_r(
raster_data="base_raster.tif",
extra_vectors=extra_vectors,
orientation="auto",
theme="dark_matter",
output_path="overlay_map.png"
)