【问题标题】:How to make lattice xyplot() grayscale in R?如何在 R 中制作 lattice xyplot() 灰度?
【发布时间】:2012-02-16 06:28:26
【问题描述】:

什么是最简单的方法来制作这个图灰度(或者可能是黑白)而不是默认的多色:

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

我见过discussion of creating new graphics devices or changing options for all plots,但我是否可以在xyplot() 函数本身中包含一个选项,将绘图转换为灰度?

【问题讨论】:

    标签: r lattice


    【解决方案1】:
    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)
    

    比较:

    【讨论】:

      猜你喜欢
      • 2012-10-05
      • 1970-01-01
      • 2016-08-02
      • 1970-01-01
      • 1970-01-01
      • 2016-04-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多