Re: [R] 4 smoothed lines on xyplot

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Thu 12 Jan 2006 - 08:35:37 EST

On 1/11/06, Dean Sonneborn <dsonneborn@ucdavis.edu> wrote:
> I am using the R code listed below to create 4 smoothed lines on a
> xyplot. I'm having trouble fine tuning it. First I think I may need a
> black and white plot so how do I get it to plot the lines with different
> characters, preferable the same characters used in the key (plus, X
> circle and triangle). I might also be interest in a version that draws
> four solid lines of different colors but when I try to use a white
> background the lines change to dots and dashs. When I don't use a white
> background it seems to use the solid colors lines.
>
> plotchar <- c(3, 4 ,1 ,2 )
>
> colr<- c("green", "blue" , "red", "black")
>
> library(lattice)
>
> trellis.par.set(col.whitebg() )
>
> xyplot(AWGT ~ lipid_adj_lpcb2_cent, groups=grpx, data=pcb_graph3,
> auto.key=TRUE, col=colr,
>
> pch=plotchar, type=c("1", "smooth"), span=.8,
>
> key=list(x=.14, y=.84,
>
> points=list(col=colr, pch=plotchar),
>
> lines=list(col=colr, pch=plotchar),
>
> text=list(levels(pcb_graph3$grpx) , col=colr, pch=plotchar)))

Why are you using both auto.key and key? Anyway, the easiest way is to change the settings and use auto.key, e.g.

xyplot(AWGT ~ lipid_adj_lpcb2_cent, groups=grpx, data=pcb_graph3,

       auto.key = list(lines = TRUE, points = TRUE),

       par.settings =
       list(superpose.symbol = list(col = colr, pch = plotchar),
            superpose.line = list(col = colr, lty = 1)),

       type=c("p", "smooth"), span=.8)

(I'm not sure what type you meant to use, your email has "1", which doesn't do anything.)

Deepayan

--
http://www.stat.wisc.edu/~deepayan/

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu Jan 12 08:42:43 2006

This archive was generated by hypermail 2.1.8 : Thu 12 Jan 2006 - 14:09:27 EST