美文网首页
R语言基础学习6

R语言基础学习6

作者: 7f0a92cda77c | 来源:发表于2021-06-24 00:29 被阅读0次
1 ggpubr
library(ggpubr)
ggscatter(iris,x="Sepal.Length",
          y="Petal.Length",
          color="Species")

p <- ggboxplot(iris, x = "Species", 
               y = "Sepal.Length",
               color = "Species", 
               shape = "Species",
               add = "jitter")
p
my_comparisons <- list( c("setosa", "versicolor"), 
                        c("setosa", "virginica"), 
                        c("versicolor", "virginica") )#对两两比较的组将其都列在一个列表中
p + stat_compare_means(comparisons = my_comparisons)+ # Add pairwise comparisons p-value
  stat_compare_means(label.y = 9) 
出的图这样
2 基础包作图的保存
pdf("file_name_you_want.pdf")
boxplot(iris[,1]~iris[,5])
text(6.5,4)
dev.off()
3 ggplot系列图(包括ggpubr)通用的简便保存 ggsave
p <- ggboxplot(iris, x = "Species", 
               y = "Sepal.Length",
               color = "Species", 
               shape = "Species",
               add = "jitter")
ggsave(p,"Name_you_want.png")#先画出来,再保存
4 eoffice包 导出为ppt,全部元素都是可编辑模式
library(eoffice)
topptx(p,"iris_box_ggpubr.pptx")

这个超级好用,个性化修改字体大小


保存的ppt格式可以任意修改

全部代码都来自于-Jimmy团队,方便学习,不做任何用途

相关文章

网友评论

      本文标题:R语言基础学习6

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