par_ts {onlineforecast} | R 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 |
p |
List of the parameters, as returned by the function itself. If given, the additional parameters set in |
... |
any of the following parameters can be set replacing the default values:
|
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)