r-graphviz

Use the `pos` argument in Rgraphviz to fix node position

一个人想着一个人 提交于 2019-12-10 02:09:34
问题 Based on this question Automatically curving an arc when it is overlapping with another one, I am trying to set the pos attribute in a RGraphviz plot. Can someone show how to correctly use the pos attribute or suggest a more robust workaround. thanks. Example To be consistent with the above linked question, the following example starts from a bnlearn graph with nodes in a grid layout. library(bnlearn) library(Rgraphviz) library(igraph) # Create graph adj <- matrix(0L, ncol = 9, nrow = 9,

Use the `pos` argument in Rgraphviz to fix node position

▼魔方 西西 提交于 2019-12-05 00:24:30
Based on this question Automatically curving an arc when it is overlapping with another one , I am trying to set the pos attribute in a RGraphviz plot. Can someone show how to correctly use the pos attribute or suggest a more robust workaround. thanks. Example To be consistent with the above linked question, the following example starts from a bnlearn graph with nodes in a grid layout. library(bnlearn) library(Rgraphviz) library(igraph) # Create graph adj <- matrix(0L, ncol = 9, nrow = 9, dimnames = list(LETTERS[1:9], LETTERS[1:9])) adj[upper.tri(adj)] <- 1 e <- empty.graph(LETTERS[1:9]) amat

bnlearn + Rgraphviz: double arrows instead of undirected edges when customizing plots

爷,独闯天下 提交于 2019-12-04 16:48:44
I am trying to customize a plot of a graph learned with bnlearn using RGraphviz . When I have undirected edges, RGraphviz turns them into directed edges to both directions when I try to customize the appearance of the graph. A reproducible example could be: set.seed(1) x1 = rnorm(50, 0, 1) x2 = rnorm(50, 0, 1) x3 = x2 + rnorm(50, 0, 1) x4 = -2*x1 + x3 + rnorm(50, 0, 1) graph = data.frame(x1, x2, x3, x4) library(bnlearn) library(Rgraphviz) res = gs(graph) options(repr.plot.width=3, repr.plot.height=3) g1 <- graphviz.plot(res) Graph not customized: So far so good. But if I try to customize it: