[R] line colors in lattice.xyplot with png device.

Marc Mamin M.Mamin at intershop.de
Fri Jul 18 15:56:16 CEST 2003


here is the solution:



col<-c("#cc0000", "#330099", "#66cc00","#ff6600" ,"#ff00cc", "#00000",
"#bo7080", "#7080bo")
lty<-c(1,1,1,1,1,1,1,1)
lwd<-c(1,1,1,1,1,1,1,1)
mylines<-list(col=col,lty=lty,lwd=lwd)

filename<- "c:\\temp\\test.png"
trellis.device(png,filename = filename, width = 940, height = 600, pointsize
= 10,  bg = "white")

trellis.par.set("superpose.line",mylines)

xyplot(HITS+FREQ~TIME   |SERVER*LOCAL, data=subset(myd,
TYPE=="xxx"),allow.multiple = TRUE, scales = "same", 
type="l",xlim=range(myd$TIME), ylim=c(0,80000),layout=c(3,2),
key = list(lines = Rows(trellis.par.get("superpose.line"),
      c(1:2)), 
      text = list(lab=c("total hits", "hits per day")),
      columns = 2),
dev.off()




Thanks to Andy Liaw and Federico C.F. Calboli


Marc Mamin




More information about the R-help mailing list