1

有没有一种使用 ReportRs获得灰度格子图的舒适方法?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")

这里

在此处输入图像描述

代替

在此处输入图像描述

4

1 回答 1

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")
于 2015-01-17T18:52:36.707 回答