addFormattedXAxis(x, epochsAsDate = FALSE, xaxis.tickFreq = list("%Q"=atChange), xaxis.labelFreq = xaxis.tickFreq, xaxis.labelFormat = "%G\n\n%OQ", ...)
an object of class
a logical indicating if the old (
FALSE) or the new
TRUE) and more flexible implementation should be used.
xaxis.* arguments are only relevant for the new
epochsAsDate = TRUE.
see the details below.
further arguments passed to
epochsAsDate = TRUE
enables very flexible formatting of the x-axis and its
annotations using the
xaxis.labelFormat arguments. The first two are named lists containing
pairs with the name being a
conversion specification and the second part is a function which based
on this conversion returns a subset of the rows in the
objects. The subsetting function has the following header:
x is a vector containing
the result of applying the conversion in
name to the epochs of
sts object and
xm1 is the scalar result when
applying the conversion to the natural element just before the first
epoch. Please note that the input to the subsetting function is converted
as.numeric before calling the function. Hence, the
conversion specification needs to result in a string convertible to integer.
Three predefined subsetting functions exist:
are used to make a tick at each (each 2nd for
change and at the median index computed on all having the same value,
atChange <- function(x,xm1) which(diff(c(xm1,x)) != 0) at2ndChange <- function(x,xm1) which(diff(c(xm1,x) %/% 2) != 0) atMedian <- function(x,xm1) tapply(seq_along(x), INDEX=x, quantile, prob=0.5, type=3)
By defining own functions here, one can obtain an arbitrary degree of flexibility.
xaxis.labelFormat is a
compatible formatting string., e.g. the default value is
"%G\n\n%OQ", which means ISO year and quarter (in roman
letters) stacked on top of each other.
NULL (invisibly). The function is called for its side effects.
Michael Höhle with contributions by Sebastian Meyer