我正在用
DiagrammeR
制作图表,但我遇到了一些节点重叠的问题。 (相关)代码如下所示(我省略了一些与颜色美学、字体大小等无关的部分):
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)
有人知道如何避免节点重叠,而不必手动定位它们吗?