如何画出美丽的弦图(Chord diagram)?
install.packages('circlize') # 安装
library(circlize) # 载入
# dataframe格式 mydata <- data.frame(Start = rep(c('S1', 'S2', 'S3'), 5), End = c('E1', 'E2', 'E3', 'E4', 'E5'), Links = 1:15)
mydata
:
# 基础弦图
chordDiagram(mydata) # 作图
circos.clear() # 还原所有参数
# 调整后的弦图chordDiagram(mydata, grid.col = c(S1 = 'lightcoral', S2 = 'coral2', S3 = 'coral4',# 圆环的颜色 E1 = 'lightgreen', E2 = 'green', E3 = 'green3', E4 = 'green4', E5 = 'olivedrab4'), annotationTrack = c('name', 'grid'), # 显示变量名称及圆环,无坐标轴 col = hcl.colors(15), # 条带的颜色 transparency = 0.5, # 透明度 directional = 1, # 条带的方向。为1时,顺序从第一列到第二列,以此类推 link.lwd = 1, # 条带边框的宽度 link.lty = 2, # 条带边框的类型 link.border = 1) # 条带边框的颜色circos.clear()
!
[1]. Gu, Z. circlize implements and enhances circular visualization in R. Bioinformatics 2014.
赞 (0)