Hi,
I want to customise the segments on an xyplot. Below is a simple example of what I'm trying to do... #Example dataset x <- c(-0.25, 0.25, 0.8) y <- c(-0.5, 0, 0.75) gp <- c("A", "I", "C") my.data <- cbind.data.frame(x,y,gp) #setting up the parameters to customise the lines with. ltype <- c(1,2,3) env.col <- c("red", "black", "blue") env.lwd <- c(1.25, 0.75, 1.25) # Lattice plot xyplot(y ~ x, data= my.data, groups = gp, type = "l", panel= panel.superpose, panel.groups = function(x,y, subscripts=subscripts, groups=groups,...){ panel.segments(0, 0, x[groups], y[groups], lty = ltype[groups], lwd=env.lwd[groups], col = env.col[groups])}) #The problem: I don't seem to have this quite right, as the resulting plot seems to ignore the lty, lwd, col that I set up. I tried to do this by using trellis.par.set/get but simply got confused. If I remove lty, lwd and col specifications I simply get all segments with the same attributes. i.e. it seems to be ignoring the "groups" #The answer I want: Segment1 has co-ordinates (0,0, x2=-0.25, y2 = -0.5) and be solid, red and of width 1.25 Segment2 has co-ordinates (0,0, x2=0.25, y2 = 0) and be dashed, black and of width 0.75 Segment3 has co-ordinates (0,0, x2=0.8, y2 = 0.75) and be dotted, blue and of width 1.25 Any help is much appreciated. Thanks and regards, Ky Mathews [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.