问题已解决。原来是出现了严重的“未阅读手册”情况。解决方法是使用ReporteRs
R软件包并阅读手册。 :)
手册:
addPlot {ReporteRs}
addPlot(doc, fun, pointsize = 12, vector.graphic = F, ...)
vector.graphic
logical scalar, if TRUE, vector graphics are produced instead of PNG images.
SVG will be produced for bsdoc objects and DrawingML instructions for docx and
pptx objects.
DrawingML instructions offer advantage to provide editable graphics
(forms and text colors , text contents, moving and resizing is disabled).
关键段落:使用DrawingML说明为pptx对象绘制图形。DrawingML说明提供可编辑的图形优势。
只需设置vector.graphic=TRUE
即可完成设置。
现在我能够在Powerpoint中编辑由R创建的图形:图例、轴标签、所有图形符号。一切。这就像提前过圣诞节!感谢ReporteRs的创建者!现在我可以在3个小时内完成以前需要300个小时才能完成的工作!太惊人了。
下面是完整的实例:
library( ReporteRs )
require( ggplot2 )
mydoc = pptx( )
mydoc = addSlide( mydoc, slide.layout = "Title and Content" )
mydoc = addTitle( mydoc, "Plot examples" )
myplot = qplot(Sepal.Length, Petal.Length
, data = iris, color = Species
, size = Petal.Width, alpha = I(0.7)
)
mydoc = addPlot( mydoc, function( ) print( myplot ), vector.graphic=TRUE)
writeDoc( mydoc, file = "~/CustomReport.pptx" )
结果:
![在此输入图片描述](https://istack.dev59.com/sdvtI.webp)
setEPS()
和postscript()
文档以获取创建.eps文件的方法,这些文件被PPT接受,可以进行矢量映射,并且至少在它们的“白色”区域是透明的。我刚刚测试了在Mac上使用透明度的rgb颜色的能力。 - IRTFM