配置ReporteRs以获得灰度晶格图

时间:2015-01-17 08:39:52

标签: r powerpoint lattice grayscale reporters

使用ReporteRs获得灰度格子图是否有一种舒适的方法? trellis.device(color=FALSE)似乎无法在这里工作

library(ReporteRs)
library(lattice)

trellis.device(color=FALSE) # set grayscale

p <- xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos,
            auto.key =list(space = "right"))

print(p) # ok, grayscale

doc = pptx("Test")
doc = addSlide(doc, "Title and Content")
doc = addPlot(doc, fun = print, x = p)  # not ok, colored
writeDoc(doc, "test.pptx")

这里

enter image description here

而不是

enter image description here

1 个答案:

答案 0 :(得分:1)

使用trellis.par.set时没关系。见下文:

library(ReporteRs)
library(lattice)

p <- xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos,
            auto.key =list(space = "right"))

ltheme <- standard.theme(color = FALSE) 

doc = pptx("Test")
doc = addSlide(doc, "Title and Content")
doc = addPlot(doc, fun = {
  trellis.par.set(ltheme)
  print(p)
}) 
writeDoc(doc, "test.pptx")