View source: R/axTicksByTime.R
axTicksByTime | R Documentation |
Compute x-axis tickmarks like axTicks
in base
but with respect to time. Additionally the first
argument is the object indexed by time which you
are looking to derive tickmark locations for.
It is possible to specify the detail you are seeking,
or by passing 'auto' to the ticks.on
argument,
to get a best heuristic fit.
axTicksByTime(x, ticks.on='auto', k = 1,
labels=TRUE, format.labels=TRUE, ends=TRUE,
gt = 2, lt = 30)
x |
the object indexed by time, or a vector of times/dates |
ticks.on |
what to break on |
k |
frequency of breaks |
labels |
should a labeled vector be returned |
format.labels |
format labels - may be format to use |
ends |
should the ends be adjusted |
gt |
lower bound on number of breaks |
lt |
upper bound on number of breaks |
This function is written for internal use, and documented for those wishing to use outside of the internal function uses. In general it is most unlikely that the end user will call this function directly.
The format.labels
argument allows for standard formatting like
that used in format
, strptime
, and strftime
.
A numeric vector of index element locations where tick marks should be drawn. These are locations (e.g. 1, 2, 3, ...), not the index timestamps.
If possible, the result will be named using formatted values from the index timestamps. The names will be used for the tick mark labels.
Jeffrey A. Ryan
endpoints
data(sample_matrix)
axTicksByTime(as.xts(sample_matrix),'auto')
axTicksByTime(as.xts(sample_matrix),'weeks')
axTicksByTime(as.xts(sample_matrix),'months',7)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.