tsplot.control: foehnix Time Series Plot Config

View source: R/tsplot.R

tsplot.controlR Documentation

foehnix Time Series Plot Config

Description

The foehnix package comes with a default time series plotting function (see tsplot) with a pre-specified behavior regarding variable names, colors, and labels. The tsplot function, however, allows to set some custom specifications, e.g., if the names of your observations (variable name of the observations in the time series object used to train the foehnix model) are different, if different labels are required, or if you do not like our pretty colors! This function returns a control object for the time series plots for customization.

Usage

tsplot.control(style = c("default", "bw", "advanced"), windsector = NULL, ...)

tsplot_get_control(x, var, property, args = list())

Arguments

style

character, name of the style template (default, advanced, bw) or path to a file containing the required information.

windsector

vector or list to highlight specific wind sectors. See foehnix:::windsector_convert for details

...

a set of named inputs to overwrite the defaults. see 'Details' section.

x

a tsplot.control object.

var

used when calling the tsplot_get_control function. Name of the (original!) variable name

property

the property which should be returned by tsplot_get_control

args

list of named arguments used when calling tsplot_get_control

Details

By default the tsplot function expects that the variable names are called

  • t: dry air temperature (degrees Celsius)

  • crest_t: dry air temperature crest (degrees Celsius)

  • rh: relative humidity (percent)

  • crest_rh: relative humidity crest (percent)

  • diff_t: temperature difference to a nearby crest station

  • dd: wind direction (meteorological degrees)

  • dd: wind direction crest (meteorological degrees)

  • ff: wind speed (meters per second)

  • crest_ff: wind speed crest (meters per second)

  • ffx: gust speed (meters per second)

  • crest_ffx: gust speed crest (meters per second)

Different style presets are available. Styles can be accessed using the style input argument. Different styles also enable/disable specific observations (e.g., the "default" style supresses the plotting of crest-station observations, even if present).

Can be set to NULL to be disabled. If the variable exists in the data set but was (manually) set to NULL it will be neglected during plotting. E.g., tsplot(mod, crest_ff = NULL, crest_ffx = NULL) to disable crest station wind speed and gust speed (on plot).

If tsplot can find these variables, it will plot the corresponding observations, label the plots, and uses a set of default colors. The tsplot.control function allows to overrule the defaults by specifying custom values, e.g.: imagine that your wind speed variable is not ff but windspd. You can easily tell tsplot that it has to use this custom name by calling tsplot as follows:

  • tsplot(x, ff = "windspd")

If your wind speed variable is not even in meters per second but knots, and you dislike our default color, you can also provide a list to overwrite the default name, default color and default label by calling:

  • tsplot(x, ff = list(name = "windspd", color = "#0000ff", label = "wind speed in knots")

In the same way it can be used to overrule the defaults for all other variables used in the time series plotting function (see list above).

Value

Returns an object of class c("tsplot.control", "data.frame") with the specification for the time series plot.

Author(s)

Reto Stauffer


retostauffer/Rfoehnix documentation built on June 5, 2023, 11:39 p.m.