I'm making a graph with DiagrammeR
and I'm having problems with some of the nodes overlapping. The (relevant) code looks like this (I ommited some irrelevant parts regarding color aesthetics, fontsizes, and more):
library(DiagrammeR)
nodes <- create_node_df(
n = 39,
type = "numbered",
label = c("Espacial", "Aeronáutica", "Nuclear", "Automotriz", "Minería", "Petróleo\ny gas", "Electrónica", "Defensa", "Metal-\nmecánica", "Náutica", "Agricultura", "Telecomu-\nnicaciones", 1:27),
width = c(rep(0.7825, 12), rep(0.2, 27)),
height = c(rep(0.7825, 12), rep(0.2, 27)),
)
edges <- create_edge_df(
from = c(rep(13, 6), rep(14, 2), 15, 16, 17, rep(18, 4), 19, rep(20, 3), rep(21, 5), 22, rep(23, 2), rep(24, 5), rep(25, 3), rep(26, 3), rep(27, 2), rep(28, 3), rep(29, 2), rep(30, 3), rep(31, 2), rep(32, 3), rep(33, 3), rep(34, 2), rep(35, 3), rep(36, 5), 37, 38, rep(39, 5)),
to = c(1, 2, 3, 4, 5, 6, 1, 2, 1, 7, 7, 1, 2, 3, 4, 7, 1, 2, 6, 1, 2, 3, 7, 8, 6, 1, 2, 1, 2, 4, 7, 8, 1, 2, 4, 1, 3, 4, 1, 9, 1, 4, 10, 1, 6, 1, 4, 9, 1, 3, 1, 11, 12, 1, 6, 7, 1, 3, 1, 2, 6, 1, 5, 6, 8, 11, 7, 1, 1, 2, 3, 4, 8),
arrowhead = "none"
)
graph <- create_graph(nodes_df = nodes, edges_df = edges)
render_graph(graph)
Does anybody know how can I avoid nodes overlapping, without having to manually position them?