Dear list, I have following plot, where I have set the color (red and green) and lines (lty=2:3) in the panel.groups but can't not figure out how change the lines and color of the legend in the "key" to the same lines and color as in the panel.groups. bwplot(means ~ age | scales , dat, panel = "panel.superpose", groups = sex,scales = list(x = list(rot = 45),cex=0.7,alternating=2), panel.groups = "panel.linejoin", lwd=1.2,lty=c(2:3),type="b",col=c ("red","green"), ylab = list(label = "mean value", cex = 0.8), xlab = list(label = "scales", cex = 0.8), key = list(lines = Rows(trellis.par.get("superpose.line"),c(1:2, 0)), cex=0.8,text = list(lab = as.character(unique(dat$sex))), columns = 2, title = " age sex", cex.title=0.9)) Thanks for any help, Tom --------------------------------- Låna pengar utan säkerhet. [[alternative HTML version deleted]]
Deepayan Sarkar
2008-Feb-19 16:32 UTC
[R] Change the color and lines of the legend using bwplot
On 2/19/08, Tom Cohen <tom.cohen78 at yahoo.se> wrote:> Dear list, > > I have following plot, where I have set the color (red and green) and lines (lty=2:3) in the panel.groups but can't not figure out how change the lines and color of the legend in the "key" to the same lines and color as in the panel.groups. > > bwplot(means ~ age | scales , dat, panel = "panel.superpose", > groups = sex,scales = list(x = list(rot = 45),cex=0.7,alternating=2), > panel.groups = "panel.linejoin", lwd=1.2,lty=c(2:3),type="b",col=c ("red","green"), > ylab = list(label = "mean value", cex = 0.8), > xlab = list(label = "scales", cex = 0.8), > key = list(lines = Rows(trellis.par.get("superpose.line"),c(1:2, 0)), cex=0.8,text = list(lab = as.character(unique(dat$sex))), > columns = 2, title = " age sex", > cex.title=0.9))key = list(lines = list(col = c("red", "green"))) should work. -Deepayan
Maybe Matching Threads
- set the lower bound of normal distribution to 0 ?
- bwplot: using a numeric variable to position boxplots
- Incompleteness in Lattice documentation (was Re: lattice question: adding slopes to bwplot)
- print multiple plots to jpeg, one lattice and one ggplot2
- panel.linejoin groups