문제

What is the simplest way to make just this plot grayscale (or perhaps black and white) rather than the default multi-colour:

xyplot(y1 + y2 ~ x, mydata, auto.key=TRUE)

I've seen discussion of creating new graphics devices or changing options for all plots, but is there an option that I can include perhaps in the xyplot() function itself that will convert the plot to grayscale?

도움이 되었습니까?

해결책

library(lattice)
bwtheme <- standard.theme("pdf", color=FALSE)
mydata <- data.frame(y1=rnorm(10), y2=rnorm(10), x=1:10)
xyplot(y1 + y2 ~ x, mydata, auto.key=TRUE, par.settings=bwtheme)

For comparison:

comparison of color vs black/white

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top