編輯 我試圖弄清楚我的代碼出了什麼問題,我開始繪製簡單的圖形以查看箭頭在較小圖形上的顯示方式。我累了下面的命令:使用igraph繪製網絡時的巨大箭頭
g2 <- graph(edges=c(1,2, 2,3, 3, 1), n=10)
plot(g2)
這是我的圖:。因此,我認爲問題不在於我的代碼,而在於使用igraph或R。我重新安裝了兩者,igraph和R,但它沒有解決問題。是否有導致這種情況的軟件包衝突?下面是一個點燃的包,我已經安裝:
[1] "base" "boot" "class" "cluster"
[5] "codetools" "colorspace" "compiler" "datasets"
[9] "dichromat" "digest" "doParallel" "foreach"
[13] "foreign" "graphics" "grDevices" "grid"
[17] "gridBase" "gtable" "igraph" "irlba"
[21] "iterators" "KernSmooth" "labeling" "lattice"
[25] "lazyeval" "magrittr" "MASS" "Matrix"
[29] "methods" "mgcv" "munsell" "nlme"
[33] "NMF" "nnet" "parallel" "pkgmaker"
[37] "plyr" "RColorBrewer" "Rcpp" "registry"
[41] "reshape2" "rngtools" "rpart" "scales"
[45] "spatial" "splines" "stats" "stats4"
[49] "stringi" "stringr" "survival" "tcltk"
[53] "tibble" "tools" "utils" "xtable"
我想產生一個網絡的情節,由於某種原因,我在我的箭頭模樣的小矩形,而不是通常的三角箭頭。
這裏是我用我的繪圖代碼:
toy.edges <- na.omit(read.csv("Data/Edge_list-toy.csv", header = TRUE, colClasses = "numeric", na.strings = c("NA", "", "#N/A")))
toy.nodes <- na.omit(read.csv("Data/NodesDataF-toy.csv", header = TRUE, na.strings = c("NA", "", "#N/A")))
toy.graph <- graph_from_data_frame(toy.edges, directed = TRUE, vertices = toy.nodes)
V(toy.graph)$color <- "magenta"
V(toy.graph)$shape <- "sphere"
V(toy.graph)$size <- 3*15^(ifelse(is.na(V(toy.graph)$node.size), 0.001,
V(toy.graph)$node.size))
plot(toy.graph, layout = layout.fruchterman.reingold(toy.graph),
vertex.label=NA, edge.width=E(toy.graph)$weight,
edge.arrow.size=0.005, edge.arrow.width=0.0000001)
而且這裏有一個例子情節:
它,當我需要稍微大一點的值edge.arrow.size
看起來更糟 和edge.arrow.width
。
我的代碼有什麼問題?它可以與R的版本有關嗎?我之前製作了大量的劇情,使用了非常相似的命令,而且我從來沒有遇到過問題。
這裏是與nodes info和edge list文件。