[R] Writing text in lattice graphics

Deepayan Sarkar deepayansarkar at yahoo.com
Tue Apr 23 20:22:06 CEST 2002


--- Luis Torgo <ltorgo at liacc.up.pt> wrote:
> Thank you very much for your help. It worked perfectly.
> 
> Without abusing your time I wonder if you could give me a help on another 
> problem with lattice graphics.
> 
> I have the following box-and-whisker plot:
> 
> > bwplot(Season ~ O2 | Site, 
>  panel = function(x,y,...) {
>   panel.bwplot(x,y,...)
>   panel.grid(h=0,v=-1)
>  })
> 
> I would like to add to each box-and-whisker a dot showing the respective mean
> 
> value (i.e. the mean O2 value for each combination of Season and Site).

Because of the way arguments are passed to the panel function in bwplot, the
following should do (in this case, grid.points would probably be overkill) : 

bwplot(y ~ x,
       panel = function(x,y,...) {
           panel.bwplot(x,y,...)
           panel.grid(h=0,v=-1)
           foo <- by(x, y, mean)
           lpoints(foo, seq(along=foo), col = 'yellow', pch = 16)
       })




> I guess it has something to do with the function "grid.points" that will 
> allow me to plot a set of points on each panel, but I'm unable to obtain the 
> points...
> 
> Any help is appreciated.
> 
> Thanks.
> 
> -- 
> Luis Torgo
>     FEP/LIACC, University of Porto   Phone : (+351) 22 607 88 30
>     Machine Learning Group           Fax   : (+351) 22 600 36 54
>     R. Campo Alegre, 823             email : ltorgo at liacc.up.pt
>     4150 PORTO   -  PORTUGAL         WWW   : http://www.liacc.up.pt/~ltorgo

__________________________________________________

Yahoo! Games - play chess, backgammon, pool and more

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list