[R] lattice - 2 graphs per panel with 2 differents colours

PtitBleu ptit_bleu at yahoo.fr
Fri Dec 11 14:03:09 CET 2009


Hello,

I would like to get a lattice plot of 8 panels (unique(df$fact)=8) with 2
graphs (df$y1 and df$y2 as a function of df$x) and 1 red point at (500,
ymax) per panel.

The script below is quite ok but I'm not able to define two different colors
for the two graphs.
If you have an idea how to use the "col" function in order to attribute the
colors, it will be very kind of you to share it with a newbie.

Have a nice week-end,
Ptit Bleu.


x11(15,12)
xyplot(df$y1 + df$y1/df$coeff ~ df$x | df$fact,
panel = function(x, y) {
                panel.grid(h=-1, v=-1, col="gray")
                panel.xyplot(x, y, type="p", pch=20)
                panel.points(500, ymax[panel.number()], col="red", pch=20,
cex=1.6)
                },
                 xlab="X", ylab="Y")

-- 
View this message in context: http://n4.nabble.com/lattice-2-graphs-per-panel-with-2-differents-colours-tp961037p961037.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list