Hi,

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:

dev.off()
  pushViewport(
    plotViewport(
      c(5, 5, 4, 2),
        xscale=c(
           min(foo),
           max(foo)),
           yscale=c(0,30)
    )
)

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@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.

Reply via email to