| axis.tind | R Documentation |
graphics Packageaxis.tind adds time axis to a plot. Axes will be added automatically
by graphics, but the default behaviour can be overridden by plotting
without axis and then calling axis.tind, see Examples.
axis.tind(
side,
x,
at,
format = NULL,
locale = NULL,
labels = TRUE,
n.breaks = 5L,
...
)
side |
see |
x |
time indices for which an axis is to be created. |
at |
(optional) time indices at which manual tick-marks and labels should be placed. |
format |
(optional) a character string determining label format
or a formatting function, see |
locale |
(optional) a character string determining locale to be used for formatting labels, see calendar-names for information on locale settings. |
labels |
a logical value determining whether automatic labels should be placed at tick-marks or a character vector of labels. |
n.breaks |
an integer value, desired number of breaks. |
... |
further arguments passed to |
Same as for axis, used for its side effect,
which is to add time axis to an existing plot.
pretty for computing pretty breakpoints,
axis_t for calculating axis parameters,
scale_tind for creating axes with ggplot2.
# load graphics
library(graphics)
# artificial data
N <- 100
df <- data.frame(d = today() + (-N + 1):0, y = cumsum(rnorm(N)))
# default axis
plot(df$d, df$y, type = "l")
# custom date format with potentially more breaks and a smaller font
plot(df$d, df$y, type = "l", xaxt = "n")
axis.tind(1, df$d, format = "%m/%d/%y", n.breaks = 7L, cex.axis = .9)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.