Draws a choropleth of data at level. Requires sf, ggplot2, and
geometry attached with geo_attach_geometry().
Usage
geo_plot(
x,
data = NULL,
level = NULL,
fill = NULL,
palette = NULL,
title = NULL,
subtitle = NULL,
fill_label = fill,
label = FALSE,
...
)Arguments
- x
A
Geoscalewith geometry attached.- data
Optional
data.framewith a code column namedleveland the column named byfill. WhenNULL, region outlines are drawn.- level
Level to draw. Defaults to the atom level.
- fill
Name of the value column in
datato colour by.- palette
Viridis palette option (
"A".."H") for the fill scale.NULL(default) leaves ggplot2's own scale in place.- title, subtitle
Plot titles.
NULLfor none.- fill_label
Legend title. Defaults to
fill; passNULLto drop it.- label
Draw region labels.
TRUEuses the display names declared by the geoscale's@meta$labelscolumn when there is one, otherwise the region codes.- ...
Passed to
ggplot2::geom_sf().
Details
This is the package's single choropleth renderer: callers that know what
their numbers mean (which variable, extensive or intensive, what units)
should prepare a data.frame and hand it here rather than draw their own
geom_sf(). energyRt::geo_map() works exactly that way.