plot_raster_single: Plot a single set of values onto a given landscape

Description Usage Arguments Examples

View source: R/plotting_functions.R

Description

Plot a single set of values onto a given landscape

Usage

1
plot_raster_single(values, landscape, title, no_data = 0, col, legend = TRUE)

Arguments

values

a named list of values, the names must correspond to cells in the landscape

landscape

a landscape to plot the values onto

title

a title string for resulting plot, the time information will be taken and appended from the landscape id

no_data

what value should be used for missing values in values

col

corresponds to the raster col plot parameter. This can be omitted and colors are handled by raster::plot

legend

corresponds to the raster legend plot parameter. This can be omitted and legend is handled by raster::plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# get path to output objects
datapath <- system.file(file.path("extdata", "WorldCenter"), package = "gen3sis")

# plot environmental variables at a given step
landscape_t_25 <- readRDS(
  file.path(datapath, "output", "config_worldcenter", "landscapes", "landscape_t_25.rds"))
oldpar <- par(no.readonly = TRUE)
par(mfrow=c(1,2))
plot_raster_single(landscape_t_25$environment[,"temp"], landscape_t_25, "Temperature", NA)
# use col to change the color
plot_raster_single(landscape_t_25$environment[,"arid"], landscape_t_25, "Aridity", NA, 
                   col=topo.colors(5))
par(oldpar)
# note that these values were scaled by the configuration object

ZHG2017/Rcpp-packageGen3sis documentation built on Dec. 18, 2021, 8:24 p.m.