生信人

找回密码
立即注册
搜索
热搜: 活动 交友 discuz
发新帖

0

收听

12

听众

318

主题
发表于 2022-9-14 10:58:27 | 查看: 1189| 回复: 0
一、条形图
  1. # 实践:绘制人染色体长度分布图
  2. x <- read.csv(file = "homo_length.csv",header = T)
  3. head(x)
  4. x <- x[1:24,]

  5. barplot(height = x$length)  
  6. barplot(height = x$length,names.arg = x$chr)  
  7. barplot(height = x$length,names.arg = x$chr,las =3)  
  8. barplot(height = x$length,names.arg = x$chr,las =3,col = rainbow(4))  
  9. barplot(height = x$length,names.arg = x$chr,las =3,col = 'red')  
  10. barplot(height = x$length,names.arg = x$chr,las =3,col = c('red','green'))
  11. library(RColorBrewer)  
  12. display.brewer.all()
  13. cols <- brewer.pal(n = 6,name = "RdPu")  
  14. barplot(height = x$length,names.arg = x$chr,col = cols)
  15. cols <- brewer.pal(n = 6,name = "Dark2")  
  16. barplot(height = x$length,names.arg = x$chr,col = cols)
  17. cols <- brewer.pal(n = 6,name = "Blues")  
  18. barplot(height = x$length,names.arg = x$chr,col = cols)
  19. cols <- brewer.pal(n = 6,name = "Set1")
  20. barplot(height = x$length,names.arg = x$chr,col = cols,las=3)
  21. barplot(height = x$length,names.arg = x$chr,col = cols,horiz = T,las=2)
  22. par('mar')
  23. barplot(height = x$length,names.arg = x$chr,col = cols,horiz = T,las=2,
  24.         border = F,width = c(1,2),space = 0.1)
  25. barplot(height = x$length,names.arg = x$chr,las=2,
  26.         border = F,width = c(1,2),space = 1,density = 12,angle = c(45,135))
复制代码

人染色体长度分布图


二、分组条形图
  1. #绘制分组条形图
  2. x <- read.csv("sv_distrubution.csv",header = T,row.names = 1)  
  3. head(x)
  4. #barplot(x)  
  5. barplot(as.matrix(x))  
  6. barplot(t(as.matrix(x)))  
  7. # barplot(t(as.matrix(x)),col = rainbow(4))  
  8. barplot(t(as.matrix(x)),col = brewer.pal(4,name = 'Set2'))
  9. barplot(t(as.matrix(x)),col = brewer.pal(4,name = 'Set2'),beside = T)  
  10. barplot(t(as.matrix(x)),col = brewer.pal(4,name = 'Set2'),
  11.         horiz = F,density = 30,angle = c(45,135))
  12. barplot(t(as.matrix(x)),col = brewer.pal(4,name = 'Set2'))
  13. barplot(t(as.matrix(x)),col = brewer.pal(4,name = 'Set2'),legend.text = colnames(x),ylim = c(0,800),  
  14.         main = "SV Distribution",xlab="Chromosome Number",ylab="SV Numbers")  
复制代码

堆叠条形图

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

您需要登录后才可以回帖 登录 | 立即注册

QQ|Archiver|手机版|小黑屋|生信人 ( 萌ICP备20244422号 )

GMT+8, 2024-11-23 21:14 , Processed in 0.092013 second(s), 31 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表