On Fri, Oct 30, 2009 at 2:10 AM, Ottorino-Luca Pantani <ottorino-luca.pant...@unifi.it> wrote: > Dear R-users, > my present problem is related to lattice. > > I would like to put some text in each panel, namely a p-value. > I therefore wrote a simple panel function as reported here below. > > I'm able to write the value in each panel at the maximum value of y for each > panel, > but this obviously overlay the text to the points. > > What I'm looking for is to write the text always in the same position along > the panels, > say in the middle of each panel > something like "ltext(x = 1.5, y = (ylim[2] - ylim[1])/2 )" > > I tried to play with "ylim" and prepanel but unsuccesfully.
Use the (lower-level) grid function grid.text(), which gives you more flexibility in units. You want something like grid.text(label, x = unit(0.5, "npc"), y = unit(0.5, "npc")) (Of course, a lattice-only solution is also possible; you could also use current.panel.limits() to compute the center of the panel in native coordinates, and then use panel.text().) -Deepayan ______________________________________________ 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.