Skip to contents

Draws a choropleth of solved results over the model's geography, optionally aggregated to a coarser level of the geoscale.

Usage

plot_map(
  object,
  type = c("generation", "capacity", "new_capacity", "fuel"),
  level = NULL,
  comm = "ELC",
  year = NULL,
  process = NULL,
  geoscale = NULL,
  palette = "D",
  name = NULL,
  facet = c("none", "year"),
  ...
)

Arguments

object

a solved scenario.

type

what to map, passed to getMix(): "generation", "capacity", "new_capacity" or "fuel". Ignored when name is given.

level

level of the geoscale to draw. Defaults to the finest, i.e. the model's own regions. A coarser level aggregates first.

comm

balanced commodity for "generation". On the name = path a comm filter applies only when passed explicitly.

year

integer year, or NULL for the sum over all milestone years.

process

optional regular expression selecting processes to include.

geoscale

a geoscales::Geoscale, or NULL to use the scenario's.

palette

viridis palette option.

name

optional name of any solved variable carrying a region dimension (e.g. "vTechNewCap", "vTechRetiredStock"): the map is drawn from getData() instead of getMix(). Variables without a region dimension (the vTrade* capacity/retirement family) cannot be mapped.

facet

"none" (default; one map, values summed over years unless year = selects one) or "year" (one panel per milestone year).

...

passed to ggplot2::geom_sf().

Value

A ggplot object.

Details

Requires a geoscale with geometry attached (see setGeoscale() and geoscales::attach_geometry_geoscale()), plus sf and ggplot2.

Examples

if (FALSE) { # \dontrun{
scen <- solve(interpolate(mod, "BASE"))
plot_map(scen, "capacity")
plot_map(scen, "capacity", level = "zone")
plot_map(scen, name = "vTechNewCap", facet = "year")
plot_map(scen, name = "vTechRetiredStock")
} # }