Re: [R] Plotting text with lattice

2006-10-05 Thread Ritwik Sinha
Hi, On a related note, if I wanted to add different texts to different panels, should I stick to using trellis.focus() for each text in each panel? I cannot figure out a way to do it using a panel function. Ritwik. On 9/29/06, Deepayan Sarkar [EMAIL PROTECTED] wrote: On 9/29/06, Gabor

Re: [R] Plotting text with lattice

2006-10-05 Thread Gabor Grothendieck
This requires R 2.4.0. Its the same as my earlier example except the labels= arg has been changed to labels=which.packet(). xyplot(x ~ x | g, data = data.frame(x = 1:12), panel = function(...) { panel.xyplot(...) panel.text(x=2, y=4, labels=which.packet()) }) On 10/5/06, Ritwik

Re: [R] Plotting text with lattice

2006-10-05 Thread Gabor Grothendieck
I seem to have omitted g library(lattice) xyplot(x ~ x | g, data = data.frame(x = 1:12, g = gl(3,4)), panel = function(...) { panel.xyplot(...) panel.text(x=2, y=4, labels=which.packet()) }) On 10/5/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: This requires R 2.4.0. Its the

Re: [R] Plotting text with lattice

2006-10-05 Thread Ritwik Sinha
Thanks Gabor, I realized I could also use this code xyplot(x ~ x | g, data = data.frame(x = 1:12, g = gl(3,4)), groups=g, panel = function(..., groups, subscripts) { panel.xyplot(...) panel.text(x=2, y=4, labels=groups[subscripts]) }) Which is essentially a rewrite of one of the

[R] Plotting text with lattice

2006-09-29 Thread McGehee, Robert
Hello, I've decided to take the leap and try my hand at the lattice package, though I am getting stuck at what one might consider a trivial problem, plotting text at a point in a graph. Apologies in advance if (that) I'm missing something extremely basic. Consider in base graphics: plot(1:10)

Re: [R] Plotting text with lattice

2006-09-29 Thread Gabor Grothendieck
Here are two possibilities. The first use trellis.focus/trellis/unfocus to add text subsequent to drawing the xyplot and the second uses a custom panel: xyplot(x ~ x, data = data.frame(x = 1:10)) trellis.focus(panel, 1, 1) panel.text(x=2, y=4, labels=Text) trellis.unfocus() xyplot(x ~ x, data =

Re: [R] Plotting text with lattice

2006-09-29 Thread Deepayan Sarkar
On 9/29/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: Here are two possibilities. The first use trellis.focus/trellis/unfocus to add text subsequent to drawing the xyplot and the second uses a custom panel: xyplot(x ~ x, data = data.frame(x = 1:10)) trellis.focus(panel, 1, 1)