Desktop Survival Guide
by Graham Williams

Plot Time Series with Axis Labels

With the same data as previously, here we control the axis labels. We tell the plot not to include axes (xaxt="n"). Then we add days to the x axis, and then we add tick marks for the hours within the day.

Image rplot-time-basic-labels

plot(zobs, plot.type="single", xaxt="n")
days <- seq(min(floor(datetimes)), max(floor(datetimes)))
axis(1, days, format(as.Date(days), "%b %d"), tcl=-0.6)
hours <- seq(min(datetimes), max(datetimes), by=1/24)
axis(1, hours, FALSE, tcl=-0.4)

Copyright © 2004-2010 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
The PDF version is a formatted comprehensive draft book (with over 800 pages).
Brought to you by Togaware. This page generated: Sunday, 22 August 2010