[R] adding text to the top corner of a lattice plot

David Winsemius dwinsemius at comcast.net
Fri Dec 17 05:26:25 CET 2010


On Dec 16, 2010, at 11:12 PM, Rajarshi Guha wrote:

> Hi, I have a series of lattice plots which I am arranging in a 2x2
> grid via print:
>
> print(p.preds, split=c(1,1, 2,2), more=TRUE)
> print(p.comp, split=c(2,1,2,2), more=TRUE)
> print(p.bw, split=c(1,2,2,2), more=FALSE)
>
> What I'd like to have is a letter (A, B, ...) in the top corner of
> each plot. While panel.text lets me add text anywhere within a plot, I
> can't seem to workout how I could put some text in the top left
> corner, say, of the whole plotting region.

If you are planning on used the internal coordinate system (in terms  
of max and min of the x and y coordinates or whatever the exact  
lattice terminology is) which is what panel.text will be expecting,   
then it is going to depend on the plotting function, arguments, and  
data .... none of which you have not provided. ( It may also depend on  
what you mean when your write "the whole plotting region", since that  
is also a bit ambiguous at the moment)

########>>>>>>>>>
> and provide commented, minimal, self-contained, reproducible code.
########>>>>>>>>


David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list