Skip to content

Architecture & Engine

The core rendering engine of geoplot-themes is not actually Python—it's R.

When you call gpt.plot_map_r(), the package performs the following pipeline:

  1. Python Validation: It validates your inputs, file paths, and color codes in Python.
  2. R Script Generation: It dynamically generates a temporary R script (.R file) containing customized ggplot2 code tailored to your exact specifications.
  3. Execution: It spawns an R subprocess using subprocess.run, running the generated script.
  4. Output: The R engine reads your shapefiles and rasters using sf and terra, builds the ggplot object, applies the requested theme, and saves a .png directly to your disk.

Required R Packages

For this to work, your system must have R installed and added to your PATH. The package will automatically attempt to install the following CRAN packages if they are missing:

  • ggplot2
  • sf
  • terra
  • ggspatial
  • ggnewscale
  • ggrepel
  • patchwork

Released under the MIT License.