[R] lattice, different plotting symbols

Hadley Wickham h.wickham at auckland.ac.nz
Fri Mar 5 01:36:24 CET 2004


Hi Matt,

> I am trying to plot different variables from a data.frame using lattice's
> xyplot using code like that below.  How do I specify a symbol and color
> for the variable 'prob' and different one's for 'll.prob'?

I think you probably want to use panel.superpose instead of 
panel.xyplot.  Behind the scenes xyplot is converting prob + ll.prob to 
groups - and panel.superpose knows how to plot different groups with 
different symbols.  Normally xyplot changes the default panel from 
panel.xyplot to panel.superpose when you use that formula construct, but 
because you've specified your own panel function it can't.

Hadley

> 
> Thanks,  Matt
> 
> xyplot( prob +  ll.prob ~ time.eff |stat.id + time.out ,data = OUT,
>        allow.multiple = TRUE,
>        layout = c(6,3), as.table = TRUE ,
> 
>        panel = function(x,y){panel.abline(h = 0)
>        panel.xyplot(x,y)},
>        strip = TRUE,
>        )
> 
> Matt Pocernich
> NCAR - Research Applications Program
> 303-497-8312
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list