Re: [R] shared axes in multipanel plot

2009-12-14 Thread Jennifer Young
splendid! This worked well, but there are two oddities that I can't resolve. 1. In the real data, the baseline is a cumulative probability plot (from simulations) rather than the straight line. The panel.lines plots this curve, but seems to join the first and last points together.

Re: [R] shared axes in multipanel plot

2009-12-14 Thread Gabor Grothendieck
On Mon, Dec 14, 2009 at 11:30 AM, Jennifer Young jennifer.yo...@math.mcmaster.ca wrote: splendid! This worked well, but there are two oddities that I can't resolve. 1. In the real data, the baseline is a cumulative probability plot (from simulations) rather than the straight line.  The

Re: [R] shared axes in multipanel plot

2009-12-14 Thread Jennifer Young
On Mon, Dec 14, 2009 at 11:30 AM, Jennifer Young jennifer.yo...@math.mcmaster.ca wrote: splendid! This worked well, but there are two oddities that I can't resolve. 1. In the real data, the baseline is a cumulative probability plot (from simulations) rather than the straight line.  The

Re: [R] shared axes in multipanel plot

2009-12-14 Thread Gabor Grothendieck
Try this: You seem to have found a problem. At any rate try this instead: pnl - function(x, y, ...) { tt - time(z) y - matrix(y, length(tt)) for(j in 1:ncol(y)) panel.plot.default(tt, y[,j], ...) panel.lines(tt, baseline, lwd = 2, col = grey(0.5)) panel.lines(tt, b2) } On Mon,

Re: [R] shared axes in multipanel plot

2009-12-14 Thread Gabor Grothendieck
One resolution of the need to go outside of pnl would be to use this line: tt - unique(x) in place of tt - time(z). That would overcome the objection that the pnl function is not self contained. On Mon, Dec 14, 2009 at 3:44 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: Try this: You

Re: [R] shared axes in multipanel plot

2009-12-14 Thread Jennifer Young
Ah, I think i see the problem. The default plot recognizes there is one set of x for each set of y, but since there were two vectors in the default.plot, the x vector is repeated and loops around for the lines part. Presumably the default plot uses your recursive plot automatically. At any rate,

Re: [R] shared axes in multipanel plot

2009-12-14 Thread Felix Andrews
I think the basic problem is that you are bringing in new data from outside the xyplot() call -- i.e `b2` and `baseline` -- and are then trying to plot that against the panel argument `x`. This is asking for trouble, as you have found, because `x` as passed to the panel function is modified by

Re: [R] shared axes in multipanel plot

2009-12-14 Thread Gabor Grothendieck
Good observation. In fact, panel.plot.default works because it uses the subscripts and groups variables which are passed down to the panel function and if not explicitly referenced in the formal argument list of pnl are passed via ... thus we could use any of these equivalent pnl functions though

[R] shared axes in multipanel plot

2009-12-11 Thread Jennifer Young
Hello I've created a function to make a plot with multiple pannels from columns of data that are created in a previous function. In the example below the number of columns is 8, giving 4 pannels, but in general it takes data with any number of columns and figures out a nice layout. The panels

Re: [R] shared axes in multipanel plot

2009-12-11 Thread Gabor Grothendieck
Try this using xyplot.zoo in the zoo package. We define the baseline and a panel function. The panel function just performs the default action to display the graphs and adds the baseline. The screens variable is 1,1,2,2,3,3,4,4. We create a zoo object from dat and use screens to name the