Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R使用riverplot的Sankey图-垂直标签_R_Label_Sankey Diagram_Riverplot - Fatal编程技术网

R使用riverplot的Sankey图-垂直标签

R使用riverplot的Sankey图-垂直标签,r,label,sankey-diagram,riverplot,R,Label,Sankey Diagram,Riverplot,我正在R中使用riverplot包。我能够制作一个Sankey图。我想能够添加一个垂直标签(最好在底部)。我发现了一个这样的例子:(我指的是图20,在顶部附近-像2004和2015这样的标签是我试图弄清楚如何创建的) 我自己怎么做 这是一个MWE,直接取自 库(riverplot) 节点这里有一种方法: library(riverplot) nodes <- c( LETTERS[1:3] ) edges <- list( A= list( C= 10 ), B= list( C=

我正在R中使用
riverplot
包。我能够制作一个Sankey图。我想能够添加一个垂直标签(最好在底部)。我发现了一个这样的例子:(我指的是图20,在顶部附近-像
2004
2015
这样的标签是我试图弄清楚如何创建的)

我自己怎么做

这是一个MWE,直接取自

库(riverplot)

节点这里有一种方法:

library(riverplot)
nodes <- c( LETTERS[1:3] )
edges <- list( A= list( C= 10 ), B= list( C= 10 ) )
r <- makeRiver( nodes, edges, node_xpos= c( 1,1,2 ),
node_labels= c( A= "Node A", B= "Node B", C= "Node C" ),
node_styles= list( A= list( col= "yellow" )) )
(coords <- plot(r))
#          A   B   C
# x        1   1   2
# top    -22 -10 -20
# center -17  -5 -10
# bottom -12   0   0
text(
  x = range(coords["x",]),
  y = min(coords["top",]),
  labels = c("left", "right"),
  pos = 1, offset = 0, font = 2
)
库(riverplot)
节点
library(riverplot)
nodes <- c( LETTERS[1:3] )
edges <- list( A= list( C= 10 ), B= list( C= 10 ) )
r <- makeRiver( nodes, edges, node_xpos= c( 1,1,2 ),
node_labels= c( A= "Node A", B= "Node B", C= "Node C" ),
node_styles= list( A= list( col= "yellow" )) )
(coords <- plot(r))
#          A   B   C
# x        1   1   2
# top    -22 -10 -20
# center -17  -5 -10
# bottom -12   0   0
text(
  x = range(coords["x",]),
  y = min(coords["top",]),
  labels = c("left", "right"),
  pos = 1, offset = 0, font = 2
)