par_ts: Set parameters for 'plot_ts()'

View source: R/par_ts.R

par_tsR Documentation

Set parameters for plot_ts()

Description

Set parameters for plot_ts() globally

Usage

par_ts(fromoptions = FALSE, p = NA, ...)

Arguments

fromoptions

logical: Read the list of parameters set in options("par_ts")$par_ts, then the additional parameters set in ... are replaced before the list is returned.

p

List of the parameters, as returned by the function itself. If given, the additional parameters set in ... are replaced before the list is returned.

...

any of the following parameters can be set replacing the default values:

xnm "t": The name of the time

legendspace 10: Horizontal space for the lengend in character spaces

legendcex 1: Scaling of the legend

legendrangeshow TRUE: Include the range for each variable in the legend

ylimextend c(lower,upper): Extend the ylim for each plot with a proportion, seperately for the lower and upper limit

yaxisextend c(lower,upper): Extend the yaxis for each plot with a proportion, seperately for the lower and upper limit

mainsline (numeric): with the line for the main in the plots.

cex (numeric): The cex to use for the plot_ts plots.

plotfun: The function used for plotting, as default lines.

xaxisformat (character): The format of the xaxis, see strptime().

colorramp colorRampPalette: The colorramp used for setting multiple colors in each plot

Details

Often in a report some plot parameters must be set for all plots, which is done with par().

The parameters which are general for plot_ts() can be set and saved in options(), and they will then be applied as default in all calls to plot_ts(). See the examples how to do this.

If any of these parameters are given to plot_ts(), then it will be used over the default.

Value

A list of the parameters above, which can be set globally (see examples) or passed to plot_ts.

Examples


# Data for plots
D <- subset(Dbuilding, 1:192)

# See the parameters which can be set
p <- par_ts()
names(p)
p$xnm

# Using the default values
plot_ts(D, c("heatload","Ta"), kseq=1:24)

# Set the parameters directly
plot_ts(D, c("heatload","Ta"), kseq=1:24, legendcex=0.8, legendspace=8)

# Set parameters to be given in a list
p <- par_ts()
p$legendcex <- 0.8
p$legendspace <- 8

# Use those parameters
plot_ts(D, c("heatload","Ta"), kseq=1:24, p=p)

# Set globally (if not set specifed the default values will be used)
options(par_ts=p)

# Now the global parameters will be used
plot_ts(D, c("heatload","Ta"), kseq=1:24)

# Still providing a parameter directly it will used, e.g. change the plotting function
plot_ts(D, c("heatload","Ta"), kseq=1:24, plotfun=points)

# Control more precisely the plotting function
plot_ts(D, c("heatload","Ta"), kseq=1:24, plotfun=function(x, ...){ points(x, type="b", ...)})

# Another colorramp function
p$colorramp <- rainbow
options(par_ts=p)
plot_ts(D, c("heatload","Ta"), kseq=1:24)


onlineforecast documentation built on Oct. 12, 2023, 5:15 p.m.