temporalPlot: Lattice plot methods for climatological series

View source: R/temporalPlot.R

temporalPlotR Documentation

Lattice plot methods for climatological series

Description

A wrapper for the lattice (trellis) plot methods for grid and station data.

Usage

temporalPlot(
  ...,
  aggr.spatial = list(FUN = mean, na.rm = TRUE),
  cols = NULL,
  lwd = 1,
  lty = 1,
  missing.dates = TRUE,
  show.na = FALSE,
  x.axis = c("dates", "index"),
  lonLim = NULL,
  latLim = NULL,
  xyplot.custom = list()
)

Arguments

...

Input grids (or station data)

aggr.spatial

list containing the function and the related arguments to perform spatial aggregation. Default is list(FUN = mean, na.rm = TRUE).

cols

Character with colors.

lwd

Numeric for line width.

lty

Numeric for line type.

missing.dates

Logical. Not implemented (see Details).

show.na

Logical. Implemented but under development (see Details).

x.axis

Character controlling the x axis. Options are "dates" (default) or "index". The first plots the data according to the date and missing dates are filled with NAs.

lonLim

Vector of length = 2, with minimum and maximum longitude coordinates, in decimal degrees, of the bounding box selected. For single-point queries, a numeric value with the longitude coordinate. If NULL (default), the whole longitudinal range is selected

latLim

Same as lonLim, but for the selection of the latitudinal range.

xyplot.custom

List of arguments as passed to xyplot. Argument panel cannot be modified, thus, if specified, it will be ignored.

Details

The function applies the xyplot method after computing spatial aggregation (parameter aggr.spatial) and member aggregation (mean and range) to the imput grids (or station data).

In case of multimember grids, the function will internally compute the ensemble mean and the range for plotting. The range is used to plot the shadow of the multimember spread.

Controlling graphical parameters

Many different aspects of the plot can be controlled passing the relevant arguments to xyplot. Fine control of graphical parameters for the trellis display can be also controlled using trellis.par.set.

Future Work

Implement parameters missing.dates (default will be TRUE) to suppress dates without values from xaxis when FALSE. Implement parameter show.na (default will be FALSE) to fill with gray NA values when TRUE. Implement auxiliary functions to reduce dependencies and remove from imports packages data.table, padr and grDevices.

Value

A lattice plot of class “trellis”.

Author(s)

M. Iturbide

Examples


require(climate4R.datasets)
require(transformeR)
data("CFS_Iberia_tas")
data("EOBS_Iberia_tas")
data("VALUE_Iberia_tas")
# Combine grids with members (CFS) and without members (EOBS)
a <- subsetGrid(CFS_Iberia_tas, years = 1985:1992)
b <- subsetGrid(EOBS_Iberia_tas, years = 1985:1992)
temporalPlot("EOBS" = b, "CFS" = a,
             xyplot.custom = list(main = "winter temperature", ylab = "Celsius"))
temporalPlot(list("EOBS" = b, "CFS" = a))
temporalPlot(list("EOBS" = b, "CFS" = a), x.axis = "index" )
# Station and grid data can be combined, also different temporal ranges
v <- subsetGrid(VALUE_Iberia_tas, years = 1988:1990)
temporalPlot("VALUE" = v, "EOBS" = b, "CFS" = a, lwd = 0.9,
             aggr.spatial = list(FUN = min, na.rm = TRUE),
             xyplot.custom = list(main = "winter temperature",
                                  ylab = "Celsius", ylim = c(-20, 10)))
# Use subsetGrid to obtain and plot a single location (no spatial aggregation)
a1 <- subsetGrid(a, lonLim = 2, latLim = 42)
b1 <- subsetGrid(b, lonLim = 2, latLim = 42)

temporalPlot("EOBS" = b1, "CFS" = a1,
             cols = c("green", "deeppink"), show.na = TRUE,
             xyplot.custom = list(main = "winter temperature", ylab = "Celsius"))


SantanderMetGroup/visualizeR documentation built on Oct. 28, 2023, 6:11 a.m.