[R] Using dates on axis with Grid plots

From: Larry White <ljw1001_at_gmail.com>
Date: Sat, 14 May 2011 10:01:15 -0400


I'm trying to use Grid plots and would like to have an X axis that represents dates. I have several years of data so I would like to be able to have labeled tick marks only intermittently (not one per date). I can transform the initial data from a date time string into POSIXlt or POSIXct, or Date objects.

The issue is that when I try to layout the plot using:


      c(5, 5, 4, 2),


I get this error, regardless of whether "foo" is formated as POSIXlt, POSIXct or Date for the xscale.

Error in valid.viewport(x, y, width, height, just, gp, clip, xscale, yscale,  :
  Invalid 'xscale' in viewport

How does one specify the scale? In the end, I would prefer something like "2007 2008", etc. to appear on the axis and, of course, I'd actually want to plot the data with an x axis of dates. I'm not yet far enough to see if that's going to be an issue.

Apologies if this is a stupid question, but it's very hard to search for Grid examples on the web, because "grid" is a very common term in R plotting generally.

        [[alternative HTML version deleted]]

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat 14 May 2011 - 14:47:36 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 25 May 2011 - 23:40:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive