How to draw a directed network graph with texts on both sides of edges in R (via iGraph, network or some other package)? -
how draw directed network graph texts on both sides of edges in r (via igraph, network or other package)?
variables (in vector autoregressive model (var)) in nodes.
the granger causalities (p values of f statistics) on both sides of edges. put p values beginning of each arrow. draw near-significant causalities added emphasize.
i not figure out how such network diagram via igraph or network package or else.
you can use edge.label
, vertex.label
options together.
library(igraph) el <- data.frame(sender = c("lnbist1f","lnbist1f","lnbist1f", "kur1f","kur1f","kur1f", "lnaltin","lnaltin","lnaltin", "mfaiz1f","mfaiz1f","mfaiz1f"), receiver = c("mfaiz1f","lnaltin","kur1f", "lnbist1f","lnaltin","mfaiz1f", "mfaiz1f","lnbist1f","kur1f", "lnbist1f","lnaltin","kur1f"), pval = c(0.5,0.6,0.1, #i typed random p-vals here 0.45,0.88,0.24, 0.12,0.51,0.99, 0.001,0.056,0.123) ) arrows = c(2,1,0,0,1,1,1,0,0,2,1,1) el <- as.matrix(el) g <- graph_from_edgelist(el[,1:2], directed = t) coordinates <- matrix(c(4, 4, 1, 1, 4, -2,7,1), nrow = 4, byrow=true) plot(g, edge.label=el[,3], vertex.shape="crectangle", vertex.size=45, edge.arrow.mode=arrows, layout = coordinates)
the edge.arrow.mode
lets control arrowheads. can move edge labels around edge.label.y
, edge.label.x
options.
Comments
Post a Comment