Returns a cowplot object for a global map plot.
plot_map4(
obj,
varnam = NA,
maxval = NA,
breaks = NA,
lonmin = -180,
lonmax = 180,
latmin = -90,
latmax = 90,
nbin = 10,
legend_title = waiver(),
legend_direction = "vertical",
colorscale = viridis::viridis,
color_ocean = "azure3",
invert = -1,
do_reproj = FALSE,
hillshade = FALSE,
rivers = FALSE,
lakes = FALSE,
coast = TRUE,
ocean = FALSE,
countries = FALSE,
dir_ne = "~/data/naturalearth/",
states = FALSE,
scale = 110,
make_discrete = TRUE,
use_geom_raster = TRUE,
is_boolean = FALSE,
plot_title = waiver(),
plot_subtitle = waiver(),
combine = TRUE,
...
)
An object, either a SpatRaster
(returned from a terra::rast()
function call),
or a list returned from a GECOr::read_nc_onefile()
function call.
A charachter string specifying the variable name. Optional and
used only if obj
is a SpatRaster
with multiple variables. If
obj
is a rbeni-nc object (returned by read_nc_onefile()
),
varnam
must be provided (a character string specifying the variable
name in obj$vars[[varnam]]
).
A numeric value specifying the maximum value for which the color key is to be extended. Defaults
to NA
(the 99% quantile of values is used).
A numeric vector specifying the breaks for the color scale. Defaults to NA
, i.e. breaks
are determined automatically based on nbin
and maxval
.
Left edge (longitude, in degrees), defaults to -180.
Right edge (longitude, in degrees), defaults to 180.
Lower edge (latitude, in degrees), defaults to -90.
Upper edge (latitude, in degrees), defaults to 90.
An integer specifying the number of bins used for the color key.
A character string specifying the legend title (annotation above the color key)
Either "vertical"
(default) or "horizontal"
.
Either function that returns a set of colors or a vector of color names from which to interpolate.
Defaults to virids::viridis
.
A color specifyier for the fill color of the ocean layer. Defaults to "azure"
.
One of 1 or -1, specifying the direction of the color scale. Defaults to -1.
A boolean specifying whether to re-project the map to Robin projection
A logical specifying whether a hillshade layer should be added. Defaults to FALSE
.
A logical specifying whether to display rivers (the ne_50m_rivers_lake_centerlines
layer from NaturalEarth.). Defaults to FALSE
.
A logical specifying whether to display rivers (the ne_50m_lakes
layer from NaturalEarth). Defaults to FALSE
.
A logical specifying whether to display coastlines (the ne_50m_coastline
layer from NaturalEarth). Defaults to TRUE
.
A logical specifying whether to display the ocean layer from NaturalEarth). Defaults to FALSE
.
A logical specifying whether to display country borders (the ne_50m_admin_0_countries
layer from NaturalEarth). Defaults to FALSE
.
A character string specifying where to download Naturalearth layers. Once downloaded, they can be quickly loaded. Defaults to "~/data/naturalearth/"
.
A logical specifying whether to display sub-country administrative borders (e.g. US states) (the ne_50m_admin_1_states_provinces
layer from NaturalEarth). Defaults to FALSE
.
An integer specifying the resolutuion of NaturalEarth layers (coast, rivers, lakes). One of 110, 50, 10
. Defaults to 110
(coarsest resolution).
NaturalEarth layers for 110, 50, 10 m are used for low, medium, and high resolution (scale) layers, respectively. Defaults to "small"
.
A logical scpecifying whether data layer is to be made discrete for plotting with colors
of discrete bins. Defaults to TRUE
.
A logical specifying whether to use the function geom_raster()
for plotting the raster layer.
Defaults to TRUE
. If FALSE
, geom_tile()
is used. The latter can yield nicer results when data is sparse.
A logical specifying whether the raster contains boolean values (either TRUE
or FALSE
). Defaults to FALSE
.
A character string specifying the plot title
A character string specifying the plot subtitle
A boolean specifying whether the map and the colorscale should be combined using cowplot.
Defaults to TRUE
. If FALSE
, a list of elements are retruned, where elements are the ggplot2 plot object
and the coloscale object returned by the call to plot_discrete_cbar.
A ggplot object for a global map plot.