EVOLUTION-MANAGER
Edit File: axis.POSIXct.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Date and Date-time Plotting Functions</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for axis.POSIXct {graphics}"><tr><td>axis.POSIXct {graphics}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Date and Date-time Plotting Functions</h2> <h3>Description</h3> <p>Functions to plot objects of classes <code>"POSIXlt"</code>, <code>"POSIXct"</code> and <code>"Date"</code> representing calendar dates and times. </p> <h3>Usage</h3> <pre> axis.POSIXct(side, x, at, format, labels = TRUE, ...) axis.Date(side, x, at, format, labels = TRUE, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x, at</code></td> <td> <p>A date-time or date object.</p> </td></tr> <tr valign="top"><td><code>side</code></td> <td> <p>See <code><a href="axis.html">axis</a></code>.</p> </td></tr> <tr valign="top"><td><code>format</code></td> <td> <p>See <code><a href="../../base/html/strptime.html">strptime</a></code>.</p> </td></tr> <tr valign="top"><td><code>labels</code></td> <td> <p>Either a logical value specifying whether annotations are to be made at the tickmarks, or a vector of character strings to be placed at the tickpoints.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Further arguments to be passed from or to other methods, typically <a href="par.html">graphical parameters</a>.</p> </td></tr> </table> <h3>Details</h3> <p><code>axis.POSIXct</code> and <code>axis.Date</code> work quite hard to choose suitable time units (years, months, days, hours, minutes or seconds) and a sensible output format, but this can be overridden by supplying a <code>format</code> specification. </p> <p>If <code>at</code> is supplied it specifies the locations of the ticks and labels whereas if <code>x</code> is specified a suitable grid of labels is chosen. Printing of tick labels can be suppressed by using <code>labels = FALSE</code>. </p> <p>The date-times for a <code>"POSIXct"</code> input are interpreted in the time zone give by the <code>"tzone"</code> attribute if there is one, otherwise the current time zone. </p> <p>The way the date-times are rendered (especially month names) is controlled by the locale setting of category <code>"LC_TIME"</code> (see <code><a href="../../base/html/locales.html">Sys.setlocale</a></code>). </p> <h3>Value</h3> <p>The locations on the axis scale at which tick marks were drawn. </p> <h3>See Also</h3> <p><a href="../../base/html/DateTimeClasses.html">DateTimeClasses</a>, <a href="../../base/html/Dates.html">Dates</a> for details of the classes. </p> <p><code><a href="zAxis.html">Axis</a></code>. </p> <h3>Examples</h3> <pre> with(beaver1, { time <- strptime(paste(1990, day, time %/% 100, time %% 100), "%Y %j %H %M") plot(time, temp, type = "l") # axis at 4-hour intervals. # now label every hour on the time axis plot(time, temp, type = "l", xaxt = "n") r <- as.POSIXct(round(range(time), "hours")) axis.POSIXct(1, at = seq(r[1], r[2], by = "hour"), format = "%H") }) plot(.leap.seconds, seq_along(.leap.seconds), type = "n", yaxt = "n", xlab = "leap seconds", ylab = "", bty = "n") rug(.leap.seconds) ## or as dates lps <- as.Date(.leap.seconds) plot(lps, seq_along(.leap.seconds), type = "n", yaxt = "n", xlab = "leap seconds", ylab = "", bty = "n") rug(lps) ## 100 random dates in a 10-week period random.dates <- as.Date("2001/1/1") + 70*sort(stats::runif(100)) plot(random.dates, 1:100) # or for a better axis labelling plot(random.dates, 1:100, xaxt = "n") axis.Date(1, at = seq(as.Date("2001/1/1"), max(random.dates)+6, "weeks")) axis.Date(1, at = seq(as.Date("2001/1/1"), max(random.dates)+6, "days"), labels = FALSE, tcl = -0.2) </pre> <hr /><div style="text-align: center;">[Package <em>graphics</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>