问题描述
R相对较新,我正在写硕士论文。我想为不同的家庭绘制多个ttest箱形图,并希望将它们排列在一个图中。要创建图,我使用以下代码
dlply(dataset2,~Family,function(x){
p<-ggplot(x,aes(x = Elf3_allele,y = plant_height,fill = Elf3_allele)) +
geom_Boxplot(fill=c("red2","chartreuse3")) +
geom_dotplot(binaxis='y',stackdir='center',dotsize = .5,fill="red") +
theme_classic() +
scale_x_discrete(name='Elf3_allele')+
theme(axis.text.x = element_text(angle=45,hjust = 1,vjust = 1),legend.title = element_text(size = 16),legend.text = element_text(size = 12)) +
scale_color_manual(values = c("cornflowerblue","darkred"))
p + stat_compare_means(method = "t.test",vjust=1,hjust=0) +
labs(title="plant_height",subtitle=x$Family)
})
这可以很好地打印图形。我如何在一个情节中获得它们? 香港专业教育学院试图包括
plist <- list(p,p)
grid.arrange(grobs=plist,ncol=2)
进入该功能,但只将同一张图形打印两次
在此先感谢您,我的英语不好。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)