View source: R/axTicksByTime.R
axTicksByTime | R Documentation |
Compute x-axis tickmarks like axTicks()
in base but with respect to
time. This function is written for internal use, and documented for those
wishing to use it for customized plots.
axTicksByTime(
x,
ticks.on = "auto",
k = 1,
labels = TRUE,
format.labels = TRUE,
ends = TRUE,
gt = 2,
lt = 30
)
x |
An object indexed by time or a vector of times/dates. |
ticks.on |
Time unit for tick locations. |
k |
Frequency of tick locations. |
labels |
Should a labeled vector be returned? |
format.labels |
Either a logical value specifying whether labels should be formatted, or a character string specifying the format to use. |
ends |
Should the ends be adjusted? |
gt |
Lower bound on number of tick locations. |
lt |
Upper bound on number of tick locations. |
The default ticks.on = "auto"
uses heuristics to compute sensible tick
locations. Use a combination of ticks.on
and k
to create tick locations
at specific intervals. For example, ticks.on = "days"
and k = 7
will
create tick marks every 7 days.
When format.labels
is a character string the possible values are the same
as those listed in the Details section of strptime()
.
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.