plot.seas.var {seas} | R Documentation |
Plot seasonal normals of a variable using boxplots.
# minimal usage plot.seas.var(x, var) # full options and default plot.seas.var(x, var, width=11, start=1, rep=0, start.day=1, col, ylim, add.alt, alt.ylab, main, ylab, ylog, ...)
x |
a data.frame with Date and var
columns of data; x can also have id or name
attributes to help give a title for the plot |
var |
a variable; a column name in x ; this can also have
attributes of units and long.name to help give a title
for the y-axis |
width |
size of bin; see mkseas |
start |
starting bin number; e.g., if width="mon" and
start=5 , the plot will start on "May" at the left-hand side |
rep |
repetition of the bins in the boxplot |
start.day |
when width is numeric, this is the starting
day of the year for the fist bin, or it can be a Date to
specify a month and day (year is ignored) |
col |
colour for the boxplots; the default is "lightgrey" |
ylim |
c(min,max) range for y-axis |
add.alt |
this adds an alternative axis, and is specified by
c(slope,inter) ; for example, if the primary measure is in
°C, a secondary scale in K would be
c(1,273.15) , or in °F would be
c(5/9,32) ; if ylog=TRUE , then this can also be
TRUE to display the log10 transformed values of
var on the alternative axis |
alt.ylab |
label for the alternate y-axis (the primary y-axis
label is set through attributes for var in x ) |
main |
title for plot; if it is missing, then it will automatically be generated |
ylab |
y-axis label; if it is missing, then it will automatically be generated |
ylog |
used to log10 transform values of
var for the boxplots; this has a similar but different affect
than specifying par(ylog=TRUE) before this function |
... |
ignored |
Shows normals of a seasonal variable using boxplots.
Returns values from boxplot
statistics on the variable.
M.W. Toews
Use mksub
to make a subset of x
.
opar <- par(no.readonly=FALSE) on.exit(par(opar)) data(mscdata) dat <- mksub(mscdata,id=1108447) plot.seas.var(dat, var="t_max", col="tomato", add.alt=c(5/9,32), alt.ylab="F") abline(h=0) par(opar) # reset graphics parameters plot.seas.var(dat, var="t_min", start=18,rep=16) pdat <- dat[dat$precip>0,] attr(pdat$precip,"long.name") <- "precipitation intensity" attr(pdat$precip,"units") <- "mm/day" par(ylog=TRUE) plot.seas.var(pdat, var="precip", col="azure") title(sub="These boxplots are simply plotted on a log-y scale") par(opar) plot.seas.var(pdat, var="precip", col="azure", ylog=TRUE) title(sub="These boxplots are based on log-transformed values") plot.seas.var(pdat, var="precip", col="azure", ylog=TRUE, add.alt=TRUE) title(sub="The actual axis for graph is on the right-side")