Usage
timePlot(mydata, pollutant = "nox", group = FALSE,
stack = FALSE, normalise = NULL, avg.time = "default",
data.thresh = 0, statistic = "mean", percentile = NA,
date.pad = FALSE, type = "default", cols = "brewer1",
plot.type = "l", key = TRUE, log = FALSE,
smooth = FALSE, ci = TRUE, ref.x = NULL, ref.y = NULL,
key.columns = 1, name.pol = pollutant, date.breaks = 7,
date.format = NULL, auto.text = TRUE, ...)
Arguments
mydata
A data frame of time series. Must include a
date
field and at least one variable to plot.
pollutant
Name of variable to plot. Two or more
pollutants can be plotted, in which case a form like
pollutant = c("nox", "co")
should be used.
group
If more than one pollutant is chosen, should
they all be plotted on the same graph together? The
default is FALSE
, which means they are plotted in
separate panels with their own scaled. If TRUE
then they are plotted o
stack
If TRUE
the time series will be
stacked by year. This option can be useful if there are
several years worth of data making it difficult to see
much detail when plotted on a single plot.
normalise
Should variables be normalised? The
default is is not to normalise the data. normalise
can take two values, either "mean"
or a string
representing a date in UK format e.g. "1/1/1998" (in the
format dd/mm/YYYY). If
avg.time
This defines the time period to average
to. Can be "sec", "min", "hour", "day", "DSTday", "week",
"month", "quarter" or "year". For much increased
flexibility a number can precede these options followed
by a space. For example, a timeAverage o
data.thresh
The data capture threshold to use (%)
when aggregating the data using avg.time
. A value
of zero means that all available data will be used in a
particular period regardless if of the number of values
available. Conversely, a value
statistic
The statistic to apply when aggregating
the data; default is the mean. Can be one of "mean",
"max", "min", "median", "frequency", "sd", "percentile".
Note that "sd" is the standard deviation and "frequency"
is the number (frequency) of valid r
percentile
The percentile level in % used when
statistic = "percentile"
and when aggregating the
data with avg.time
. More than one percentile level
is allowed for type = "default"
e.g.
percentile = c(50, 95)
date.pad
Should missing data be padded-out? This
is useful where a data frame consists of two or more
"chunks" of data with time gaps between them. By setting
date.pad = TRUE
the time gaps between the chunks
are shown properly, rather than
type
type
determines how the data are split
i.e. conditioned, and then plotted. The default is will
produce a single plot using the entire data. Type can be
one of the built-in types as detailed in cutData
e.g. "season", "
cols
Colours to be used for plotting. Options
include "default", "increment", "heat", "jet" and
RColorBrewer
colours --- see the openair
openColours
function for more details. For user
defined the user can sup
plot.type
The lattice
plot type, which is a
line (plot.type = "l"
) by default. Another useful
option is plot.type = "h"
, which draws vertical
lines.
key
Should a key be drawn? The default is
TRUE
.
log
Should the y-axis appear on a log scale? The
default is FALSE
. If TRUE
a well-formatted
log10 scale is used. This can be useful for plotting data
for several different pollutants that exist on very
different scales. I
smooth
Should a smooth line be applied to the
data? The default is FALSE
.
ci
If a smooth fit line is applied, then ci
determines whether the 95% confidence intervals aer
shown.
ref.x
Add a vertical dashed reference line at this
value.
ref.y
Add a horizontal dashed reference line at
this value.
key.columns
Number of columns to be used in the
key. With many pollutants a single column can make to key
too wide. The user can thus choose to use several columns
by setting columns
to be less than the number of
pollutants.
name.pol
This option can be used to give
alternative names for the variables plotted. Instead of
taking the column headings as names, the user can supply
replacements. For example, if a column had the name "nox"
and the user wanted a different descript
date.breaks
Number of major x-axis intervals to
use. The function will try and choose a sensible number
of dates/times as well as formatting the date/time
appropriately to the range being considered. This does
not always work as desired automatically. Th
date.format
This option controls the date format
on the x-axis. While timePlot
generally sets the
date format sensibly there can be some situations where
the user wishes to have more control. For format types
see strptime
. For ex
auto.text
Either TRUE
(default) or
FALSE
. If TRUE
titles and axis labels will
automatically try and format pollutant names and units
properly e.g. by subscripting the `2' in NO2.
...
Other graphical parameters are passed onto
cutData
and lattice:xyplot
. For example,
timePlot
passes the option hemisphere =
"southern"
on to cutData
to provide southern
(rather t