Re: [R] questions about plot.zoo

From: tom soyer <tom.soyer_at_gmail.com>
Date: Wed, 26 Dec 2007 23:28:03 -0600

Thanks Gabor!

Also, can you give an example of customizing the major tick marks on the x-axis and adding minor tick marks between major tick marks?

On 12/26/07, Gabor Grothendieck <ggrothendieck_at_gmail.com> wrote:
>
> On Dec 26, 2007 10:55 PM, tom soyer <tom.soyer@gmail.com> wrote:
> > I have been having very good results using plot.zoo to chart time series
> >[...]
> > (1) when I tried to use semi-log scale, via log="y", R issued a warning,
> > although it looked like plot.zoo plotted in semi-log scale anyway:
> >
> > Warning message:
> > In plot.xy(xy.coords(x, y), type = type, ...) :
> > "log" is not a graphical parameter
> > Does anyone know if I should ignore the warning, or discard the semi-log
> > looking graph instead?
>
> 1. plot.zoo is passing the log= argument to the panel and in this case
> panel=lines. You can (a) ignore the warning, (b) use suppressWarnings
> or (c) use a custom panel which excludes log:
>
> lines2 <- function(...) { L <- list(...); L$log <- NULL; do.call(lines, L)
> }
> z <- zoo(1:100)
> plot(z, log = "y", panel = lines2)
>
> > (2) I noticed that plot.zoo automatically generates major tick marks for
> the
> > user. But does anyone know how to customize the major tick marks on the
> > y-axis, and adding minor tick marks between them? I tried both axis()
> and
> > minor.tick in the Hmisc package, but could not make them work. It seems
> that
> > axis() and minor.tick do not work well with dates.
>
> 2. If you are using a single panel then try this:
> plot(z, yaxt = "n")
> axis(2, c(1, 10, 100))
>
> >
> > (3) I tried to add horizontal grid like this:
> >
> > x=axis(4)
> > abline(h=x,col="light gray")
> >
> > It works... but unfortunately, the grid lines are all drawn on top, or
> in
> > front, of the lines or bars of data on the chart. As a result, the grid
> > lines cover up the lines of data when they cross each other. Does anyone
> > know if it is possible to specify the order of lines on a chart, i.e.,
> > something like the z-index, so that the grid lines are behind the data
> > lines? If not, then what would be the proper way of adding gridlines so
> that
> > thay are consistent with the major and minor tick marks?
>
> Try using xyplot.zoo. See:
> ?xyplot.zoo
> for an example which specifically shows how to do it.
>

-- 
Tom

	[[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 Thu 27 Dec 2007 - 05:32:09 GMT

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 Thu 27 Dec 2007 - 08:30:20 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.