使用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")
这里
而不是
答案 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")