Y 叔说作图用R,然后修图用ppt。毕竟ps不是每个人都会,而且PS名声在外。
以下转载自Y叔公众号
安装R包,
install.packages("export")
library(export)
library(effects)
fit=lm(prestige ~ type + income*education, data=Prestige)
plot(Effect(c("income", "education"), fit),multiline=T, ci.style="bands")
##说明:在R-studio中运行,前面只要输出图像后。在预览窗口选中对应的图像,运行下面命令即可生成对应的pptx文件。文件名,大小。
#如果图片太大,导出的文件是矢量,会特别大,打开速度比较慢。
graph2ppt(file="effect plot.pptx",width=7,height=5)
##在引入export包后,可以写一个简单函数,一次输出多种类型的图。
out_img <- function(filename,pic_width=5,pic_height=7){
graph2png(file=filename,width=pic_width,height=pic_height)
graph2ppt(file=filename,width=pic_width,height=pic_height)
graph2tif(file=filename,width=pic_width,height=pic_height)
}
#调用函数
out_img(filename="filter_count")
#调用函数,同时指定宽度和高度
out_img(filename="heatmap",pic_width=7,pic_height=7)
该包中可用的工具
graph2bitmap
graph2doc
graph2eps
graph2jpg
graph2office
graph2pdf
graph2png
graph2ppt
graph2svg
graph2tif
graph2vecto
table2csv
table2csv2
table2doc
table2excel
table2html
table2office
table2ppt
table2spreadsheet
table2tex
网友评论