How to make lattice xyplot() grayscale in R?

前端 未结 1 935
死守一世寂寞
死守一世寂寞 2021-02-13 21:29

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         


        
1条回答
  •  鱼传尺愫
    2021-02-13 22:08

    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

    0 讨论(0)
提交回复
热议问题