R绘图导入ppt

转自:https://guangchuangyu.github.io/cn/2019/04/export-office/

在PPT中编辑你的图
这里我们需要一个神器export包,安装很简单,因为在CRAN上。

install.packages("export")
library(export)

举个例子,下面这个图,用lattice画出来:

library(effects)
fit=lm(prestige ~ type + income*education, data=Prestige)
plot(Effect(c("income", "education"), fit),multiline=T, ci.style="bands")

有了export包的助攻之后,我们只需要一句语句,就可以把这个图导出到PPT中去:

graph2ppt(file="effect plot.pptx", width=7, height=5)

然后只要你在PPT中取消组合,那么所有的元素都是分离的,而且是矢量格式,你可以修改字体,改大小,改颜色,等等。

改完之后,你如果想导出为PDF的话,那么图片在导出的PDF中,也是矢量的。

可以导出各种文件
这个包提供了各种函数,你可以通过graph2doc导出到Word,还支持通过graph2office导出到LibreOffice。

graph2bitmap
graph2doc
graph2eps
graph2jpg
graph2office
graph2pdf
graph2png
graph2ppt
graph2svg
graph2tif
graph2vector
而且更为良心的是,连表格也是支持的。

table2csv
table2csv2
table2doc
table2excel
table2html
table2office
table2ppt
table2spreadsheet
table2tex

posted @ 2019-10-12 13:41  yuwq  阅读(1163)  评论(0编辑  收藏  举报