0
我正在嘗試生成一條河流,但是我看起來像邊緣的輸出來自每個條的錯誤側面,這使得它很難解釋。 爲什麼我的河牀很奇怪?
我使用的數據是:
邊緣:
N1 N2 Value
1 off off.1 0.77149877
2 weak off.1 0.47474747
3 medium off.1 0.17537313
4 strong off.1 0.03603604
5 off low.1 0.06879607
6 weak low.1 0.26262626
7 medium low.1 0.13432836
8 strong low.1 0.01351351
9 off medium.1 0.12530713
10 weak medium.1 0.23232323
11 medium medium.1 0.54850746
12 strong medium.1 0.20720721
13 off strong.1 0.03439803
14 weak strong.1 0.03030303
15 medium strong.1 0.14179104
16 strong strong.1 0.74324324
節點:
ID x y
1 off 1 4
2 weak 1 3
3 medium 1 2
4 strong 1 1
5 off.1 2 4
6 low.1 2 3
7 medium.1 2 2
8 strong.1 2 1
和情節的代碼是:
library(RColorBrewer)
library(riverplot)
palette = paste0(brewer.pal(5, "Set2"), "60")
styles = lapply(nodes$y, function(n) {
list(col = palette[n+1], lty = 0, textcol = "black")
})
names(styles) = nodes$ID
nlabels <- c(off = 'off', weak = 'weak', medium = 'medium',strong = 'strong',
off.1 = 'off', weak.1 = 'weak', medium.1 = 'medium', strong.1 = 'strong')
x <- makeRiver(nodes, edges, node_styles = styles, node_labels = nlabels)
plot(x)
你能否更詳細地解釋你的問題? –
嗨@MarcoSandri。問題在於,通常在河流邊緣應組織邊緣,使頂部節點的鏈接從頂部離開,從第二個頂部離開第二個,等等。這意味着單個節點的邊不會交叉。然而,在這個陰謀這個規則似乎是相反的(見圖) –
下面你可以找到我的建議,以生成一個圖(我希望)你在找什麼。讓我知道。 –