View source: R/LPJmLData_plot.R
plot.LPJmLData | R Documentation |
Function to plot a time-series or raster map of an LPJmLData
object.
## S3 method for class 'LPJmLData'
plot(x, subset = NULL, aggregate = NULL, raster_extent = NULL, ...)
x |
LPJmLData object |
subset |
List of array dimension(s) as name/key and
corresponding subset vector as value, e.g. |
aggregate |
List of array dimension(s) as name/key and
corresponding aggregation function as value, e.g. |
raster_extent |
Optional parameter to crop map display of spatial data.
An extent or any object from which an Extent object can be
extracted. Not relevant if |
... |
Arguments passed to plot and plot |
Depending on the dimensions of the LPJmLData object's internal data array the plot will be a ...
single map plot: more than 8 "cell"
s or "lat"
& "lon"
dimensions
available)
multiple maps plot: length of one time (e.g."time"
, "year"
,
"month"
) or "band"
dimension > 1.
time series plot: less than 9 "cell"
s
lat/lon plot: a subsetted/aggregated "lat"
or "lon"
dimension
The plot can only handle 2-3 dimensions. Use arguments subset
and
aggregate
to modify x$data
to the desired plot type. If more than three
dimensions have length > 1,' plot will return an error and suggest to reduce
the number of dimensions.
Note that the plot function aims to provide a quick overview of the data rather than create publication-ready graphs.
No return value; called for side effects.
## Not run:
vegc <- read_io(filename = "./vegc.bin.json")
# Plot first 9 years starting from 1901 as a raster plot
plot(vegc)
# Plot raster with mean over the whole time series
plot(vegc,
aggregate = list(time = mean))
# Plot only year 2010 as a raster
plot(vegc,
subset = list(time = "2010"))
# Plot first 10 time steps as global mean time series. Note: Aggregation
# across cells is not area-weighted.
plot(vegc,
subset = list(time = 1:10),
aggregate = list(cell = mean))
# Plot time series for cells with LPJmL index 27410 - 27415 (C indices start
# at 0 in contrast to R indices starting at 1).
plot(vegc,
subset = list(cell = 27411:27416))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.