【傻瓜美图】桑葚能量流动图

数据格式整理为


数据格式

图的意思是做了差异基因从0-4-12小时的变化分类

library(ggalluvial)
##-----------示例数据及代码——————————————————————————
titanic_wide <- data.frame(Titanic)
head(titanic_wide)
ggplot(data = titanic_wide,
       aes(axis1 = Class, axis2 = Sex, axis3 = Age,
           y = Freq)) +
  scale_x_discrete(limits = c("Class", "Sex", "Age"), expand = c(.2, .05)) +
  xlab("Demographic") +
  geom_alluvium(aes(fill = Survived)) +
  geom_stratum() +
  geom_text(stat = "stratum", aes(label = after_stat(stratum))) +
  theme_minimal() +
  ggtitle("passengers on the maiden voyage of the Titanic",
          "stratified by demographics and survival")

-------------自己数据照搬试试一下下

data <- read.csv("test.csv",header = T)
ggplot(data,
       aes(y = Freq, axis1 = cluster, axis2 = H4_vs_H0change, axis3 =H12_vs_H4change)) +
  geom_alluvium(aes(fill =color )) +
  geom_stratum(width = .3) +
  scale_x_discrete(limits = c("cluster", "H4_vs_H0change", "H12_vs_H4change"), 
                   expand = c(.05, .05)) +
  theme_void()+
  geom_text(stat = "stratum", aes(label = after_stat(stratum)),size=5)+
  #scale_fill_manual(values = pal_npg()(7))
  #geom_flow(width =0.3,curve_type = "sine",color = 'white',size = 0.1)+
  #scale_fill_brewer(type = "qual", palette = "palette1")
  scale_fill_manual(values = c("navy", "grey","firebrick3","#70493D","#E2AC76",
"#3F752B","#81B0E4"))
  #scale_fill_manual(values = col)
  #xlab("Demographic")+
  #ggtitle("passengers on the maiden voyage of the Titanic",
          "stratified by demographics and survival")
image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容