[R] Plotting Time against Date for time series data? (2)

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon May 17 21:30:13 CEST 2004


On Mon, 17 May 2004, Sander Oom wrote:

> Almost but not quite:
> 
> Someone told me R would produce such high quality graphics, I would never 
> need a separate graphics package again. This does however mean that I need 
> to be able to draw the graph exactly the way I want it to look!
> 
> I have searched the web and help files extensively, but there are few 
> references on plotting time on an axis. 

You don't have `time', you have a set of numbers in 0-24.  I did suggest
you treat them as such.

> The function presented here 
> (http://tolstoy.newcastle.edu.au/R/help/00a/1031.html) could be useful, but 
> I'm not sure how to implement it in my example. Anyway there should be a 
> simpler way.
> 
> The following code uses the example again. It does have hours on the 
> x-axis, but the tic marks are printed as: 0, 5, 10, 15, 20. Not a very 
> intuitive frequency of tic marks. How do I get R to plot tic marks at: 0, 
> 4, 8, 12, 16, 20, 24 or 0, 2, 4..., 24? I want the tic marks to be fixed, 

Use axis(), of course. That is in all the basic info on R, as well as all
good books on S/R.

> i.e. they should still go from 0-24 even when the range of the data is
> smaller.


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list