[R] xyplot with different symbols and colors?

Deepayan Sarkar deepayan.sarkar at gmail.com
Fri Aug 25 18:44:25 CEST 2006


On 8/25/06, Sebastian P. Luque <spluque at gmail.com> wrote:
> On Fri, 25 Aug 2006 17:51:24 +0200,
> Stefan Grosse <singularitaet at gmx.net> wrote:
>
> > Dear List, I try to make a xyplot with different colors and symbols, I
> > came this far:
>
> > library(DAAG)
> > xyplot(csoa~it|sex*agegp,data=tinting,groups=target,pch=list(1,2),auto.key=list(space
> > = "right"))
>
>
> > this produces a plot with different colors and symbols but unfortunately
> > the legend does only follow the color scheme and not the different
> > symbols.
>
> > Any suggestions what to change?
>
>
> I think that 'pch' is passed only to the panel function, and the key uses
> whatever the current trellis.par.set() is, if you don't define it
> explicitly (all explained in ?xyplot).  I find it easier to call
> trellis.par.set before the xyplot:
>
>
> R> trellis.par.set(superpose.symbol=list(pch=c(1, 2)))
> Warning message:
> Note: The default device has been opened to honour attempt to modify trellis settings in: trellis.par.set(superpose.symbol = list(pch = c(1, 2)))
> R> xyplot(csoa~it|sex*agegp,data=tinting,groups=target,auto.key=list(space="right"))

Also, see the entry for 'par.settings' in help(xyplot).

-Deepayan



More information about the R-help mailing list