Learn R Programming

seas (version 0.3-3)

plot.seas.var: Plot seasonal normals of a given variable

Description

Plot seasonal normals of a variable using boxplots.

Usage

plot.seas.var(x, var)

plot.seas.var(x, var, width=11, start=1, rep=0, start.day=1,
              col, ylim, add.alt, alt.ylab, main, ylab, ...)

Arguments

x
a data.frame with Date and var columns of data; x can also have id or name attributes to help g
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 {degrees }C, a secondary scale in K would be c(1,273.15), or in {degrees }F would
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
...
ignored

Value

  • Returns values from boxplot statistics on the variable.

encoding

latin1

synopsis

plot.seas.var(x, var, width=11, start=1, rep=0, start.day=1, col, ylim, add.alt, alt.ylab, main, ylab, ...)

Details

Shows normals of a seasonal variable using boxplots.

See Also

plot.seas.norm, plot.year. Use mksub to make a subset of x.

Examples

Run this code
data(mscdata)
dat <- mksub(mscdata,id=1108447)
mar <- par("mar")

plot.seas.var(dat, var="t_max", col="tomato",
  add.alt=c(5/9,32), alt.ylab="F")
abline(h=0)

par(mar=mar) # return margin back
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"

plot.seas.var(pdat, var="precip", col="azure")

Run the code above in your browser using DataLab