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, y.relation = "same",
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 on the sam
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 norm
avg.time
This defines the time period to average to. Can be
sec, min, hour, day,
DSTday, week, month, quarter
or year
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 of 100 w
statistic
The statistic to apply when aggregating the data;
default is the mean. Can be one of mean, max,
min, median, frequency, sd,
percentile
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)
. No
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 with a l
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
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. It is ther
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.
y.relation
This determines how the y-axis scale is plotted. "same"
ensures all panels use the same scale and "free" will use panel-specfic
scales. The latter is a useful setting when plotting data with very
different values.
ref.x
See ref.y
for details. In this case the
correct date format should be used for a vertical line e.g. ref.x
= list(v = as.POSIXct("2000-06-15"), lty = 5)
.
ref.y
A list with details of the horizontal lines to be
added representing reference line(s). For example, ref.y =
list(h = 50, lty = 5)
will add a dashed horizontal line at
50. Several lines can be plotted e.g. ref.y = list(h = c(50,
100
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
d
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. The user can
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
example, t
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 than defau