[R] Removing tick marks and Adding labels to lattice plots

David Winsemius dwinsemius at comcast.net
Sun Nov 21 00:45:45 CET 2010

On Nov 20, 2010, at 6:32 PM, kateF87 wrote:

> Hi all,
> I am trying to remove the current labels of the tick marks and  
> replace them
> with text using xyplot within lattice
> right now I have tick marks at 1, 1.5, 2, 2.5, 3 I would like to  
> transform
> them to say 'T1', 'T2', 'T3'

In the xyplot documentation you will find the controls for ticks and  
labels in the scale section. You have not given a well-formed example   
because the number of labels does not align with the number of ticks  
so I am going to assume there are currently 5 ticks to be relabeled.  
Perhaps something along these lines:

xyplot( <some-formula> ,
           scales=list(x=list(labels=c('T1', 'T2', 'T3' , 'T4',  
'T5'))) )

Notice the way the arguments are all packaged as nested lists. That  
the way lattice works.


David Winsemius, MD
West Hartford, CT

More information about the R-help mailing list