最近小编在看文献的过程中看见了一种新的图,名字叫做桑基图(Sankey plots),在该文献中展示的是ceRNA网络,看起来很是炫酷呀!
首先来了解下什么是桑基图,桑基图,全称为桑基能量平衡图,可以用于展示数据的变化。它的特征是能量平衡,可用于多种数据类型的可视化分析。制作工具有R,Python等编程语言。小编主要为大家介绍利用R语言来绘制桑基图。下面小编将绘制桑基图的方法推荐给大家。在这里,主要为大家介绍riverplot这个包。install.packages("riverplot")这个包中有几个功能,包括curveseg ,makeRiver, minard , plot.riverplot , riverplot-styles(1)curveseg,它主要用于绘制一个弯曲的部分,这里我们以绘制一条DNA链为例:par( usr= c( 0, 4, -2.5, 2.5 ) )cols <- c( "green", "blue" )for( i in rep( rep( c( 1, 2 ), each= 2 ), 5 ) ) {curveseg( init[i], init[i] + step, pos[1], pos[2], width= w, col= cols[i] )init[i] <- init[i] + step
(2)makeRiver,它用于创建一个新的riverplot对象nodes <- c( LETTERS[1:4] )edges <- list( A= list( D= 10 ), B= list( D= 10 ),C=list(D=10) )r <- makeRiver( nodes, edges, node_xpos= c( 1,1,1,2 ),node_labels= c( A= "Node A", B= "Node B", C= "Node C",D="Node D" ),node_styles= list( A= list( col= "yellow" ),B=list(col="red"),C=list(col="green")) )
(3)minard:这是查尔斯约瑟夫米纳德用来生成著名图表的数据集nodes <- minard$nodes ##定义点edges <- minard$edges ##定义边colnames( nodes ) <- c( "ID", "x", "y" )colnames( edges ) <- c( "N1", "N2", "Value", "direction" )edges$col <- c( "#e5cbaa", "black" )[ factor( edges$direction ) ] ##着色river <- makeRiver( nodes, edges )style <- list( edgestyle= "straight", nodestyle= "invisible" )plot( river, lty= 1, default_style= style )
(4)plot.riverplot:创建一个Sankey图
(5)riverplot-styles:这是一个调整Riverplot样式的函数ex <- riverplot.example() ##创建一个riverplot的实例plot( ex, default_style= ds )
ds[["col"]] <- "#FF000099"plot( ex, default_style= ds )
这就是基本的桑基图绘制,具体应用还需要大家自己慢慢钻研呀~Construction and comprehensive analysis of a ceRNA network to reveal potential prognostic biomarkers for hepatocellular carcinoma.欢迎关注生信人
TCGA | 小工具 | 数据库 |组装| 注释 | 基因家族 | Pvalue
基因预测 |bestorf | sci | NAR | 在线工具 | 生存分析 | 热图
生信不死 | 初学者 | circRNA | 一箭画心| 十二生肖 | circos
舞台|基因组 | 黄金测序 | 套路 | 杂谈组装 | 进化 | 测序简史
