美文网首页
R绘图导入ppt中

R绘图导入ppt中

作者: 余绕 | 来源:发表于2021-05-07 17:08 被阅读0次

如下步骤是把R生成的图片导入到ppt中进行编辑。具体步骤如下:
其中 R tools 需要手动安装升级到最新(安装的时候注意勾选 添加到本地默认路径);export包需要本地手动安装。

#安装依赖
install.packages("officer")
install.packages("rvg")
install.packages("openxlsx")
install.packages("ggplot2")
install.packages("flextable")
install.packages("xtable")
install.packages("rgl")
install.packages("stargazer")
install.packages("tikzDevice")
install.packages("xml2")
install.packages("broom")
install.packages("devtools")
devtools::install_github("tomwenseleers/export")#如果此步报错,则选择下载安装包本地安装

#本地安装步骤(前面依赖还是要手动安装)

library(usethis)
library(devtools)

devtools::install_local("C:/Users/TAO/Documents/export-master.zip")

#加载包
library(export)
library(reshape2)
library(ggplot2)
library(forcats)

setwd("C:/Users/TAO/Documents")
pathway<-read.csv("714.csv")

pathway$Description=fct_inorder(pathway$Description)

p=ggplot(pathway,aes(y=pathway$Description,x=-log10(pathway$FDR)))

pbubble=p+geom_point(aes(size=pathway$emrichment,color=-log10(pathway$FDR)))

pr=pbubble+scale_color_gradient2(low="darkturquoise",mid="yellow",high='red',midpoint=26)

pr+theme_bw()

#输出到ppt

graph2ppt()      
graph2ppt(file="ggplot2_plot.pptx", aspectr=1.7) #ppt文件输出到设定目录

```R

相关文章

网友评论

      本文标题:R绘图导入ppt中

      本文链接:https://www.haomeiwen.com/subject/igcedltx.html