tfc_plot {SeaVal} | R Documentation |
plotting function for tercile forecasts
Description
Plots spatial maps of tercile forecasts. Requires a data table with three columns "below"
, "normal"
, "above"
which sum to 1. For each gridpoint only the highest of the three values is plotted, so there are three colorscales.
Usage
tfc_plot(
dt,
discrete_cs = TRUE,
rmax = NULL,
below = "brown",
normal = "gold",
above = "forestgreen",
na.value = "gray75",
cs_names = c("below", "normal", "above"),
oob = NULL,
guide_barwidth = grid::unit(0.01, units = "npc"),
guide_barheight = grid::unit(0.15, units = "npc"),
legend_horizontal = FALSE,
binwidth = "auto",
add_map = TRUE,
extent = NULL,
expand.x = c(0, 0),
expand.y = c(0, 0),
showplot = TRUE,
dimension_check = TRUE
)
Arguments
dt |
Data table containing the data for plotting. |
discrete_cs |
Logical. Do you want to use discrete color scales (default) or not. |
rmax |
Optional value to fix the range of the colorscale (lower limit is always 0.33). |
below , normal , above |
Colors to use for the three categories. Default is |
na.value |
Color to use for missing value. Default is |
cs_names |
Character vector of length three giving the legend titles for the below-, normal-, and above category. |
oob |
Behavior for data above |
guide_barwidth , guide_barheight |
value to specify the width and height of the color guide. Are flipped if |
legend_horizontal |
Logical. Set to |
binwidth |
Width of the steps when a discrete colorscale is used. |
add_map |
logical, defaults to |
extent |
An optional four-element vector in the order xmin,xmax,ymin,ymax for specifying the spatial extent of the plot. Default is to fit the extent to the data. |
expand.x , expand.y |
vectors with two entries to be added to xlims/ylims of the plot. E.g. expand.x = c(-0.5,0.5) expands the plot by half a longitude both on the right and left hand side. |
showplot |
Logical. Should the plot be displayed at the end? |
dimension_check |
Logical. By default the function checks that there are not multiple values per coordinate
(and subsets to the first level if there are several, e.g. to the first year and month (by appearance in |
Value
a ggplot object.
Author(s)
Claudio Heinrich
Examples
#dt = tfc_from_efc(ecmwf_monthly[month == 11 & lat < 0])
#pp = tfc_plot(dt[year == 2018])
#if(interactive()) plot(pp)