install.packages("ggpubr")
library(readxl)
library(ggplot2)
library(ggpubr)
library(ggthemes)
df <- read_excel("E1.xlsx")
df$CHD <- ifelse(df$CHD == 0, "No", "Yes")
p <- ggplot(df, aes(x = Gender, y = BMI, fill = CHD)) + geom_boxplot()+
stat_compare_means(method = "t.test",label = "p.signif",size=6,label.y = 40)
p1 <- p + theme_few()
p1 <- p+ggtitle("")+
theme(legend.position = c(0.75,0.05),
legend.background = element_blank(),
legend.text = element_text(size = 8),
legend.title = element_text(size = 8,vjust = 0.5,hjust = 0,margin = margin(r = 10)))+
guides(fill=guide_legend(nrow = 1,byrow = TRUE,title.position = "left"))
p1
p2 <- ggplot(df, aes(x = Hypertension, y = SBP, fill = Hypertension)) +
geom_jitter(aes(color = Hypertension),show.legend = FALSE)+
geom_boxplot(fill = "gray",notch = TRUE,show.legend = FALSE)
p3 <- p2 + theme_few()
p3
p4 <- ggplot(df, aes(x = Hypertension, y = DBP, fill = Hypertension)) +
geom_jitter(aes(color = Hypertension),show.legend = FALSE)+
geom_boxplot(fill = "gray",notch = TRUE,show.legend = FALSE)
p5 <- p4 + theme_few()
p6 <- ggplot(df, aes(x = Hypertension, y = RBG, fill = Hypertension)) +
geom_jitter(aes(color = Hypertension),show.legend = FALSE)+
geom_boxplot(fill = "gray",notch = TRUE,show.legend = FALSE)
p7 <- p6 + theme_few()
gridExtra::grid.arrange(p1,p3,p5,p7,ncol=2)
2201_75813860
- 粉丝: 0
- 资源: 2
最新资源
- 基于CSS与JavaScript的积分系统设计源码
- 生物化学作业_1_生物化学作业资料.pdf
- 基于libgdx引擎的Java开发连连看游戏设计源码
- 基于MobileNetV3的SSD目标检测算法PyTorch实现设计源码
- 基于Java JDK的全面框架设计源码学习项目
- 基于Python黑魔法原理的Python编程技巧设计源码
- 基于Python的EducationCRM管理系统前端设计源码
- 基于Django4.0+Python3.10的在线学习系统Scss设计源码
- 基于activiti6和jeesite4的dreamFlow工作流管理设计源码
- 基于Python实现的简单植物大战僵尸脚本设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈