如何在不影响标签字体大小的情况下增加GraphViz中节点之间的间距?
我正在尝试使用GraphViz(即grViz())创建一个包含24个主节点和一些其他辅助节点的流程图 我希望增加节点之间的间距,以获得清晰的视图。但是它减少了每个节点中标签的字体大小,尽管我为每个节点的标签保留了如何在不影响标签字体大小的情况下增加GraphViz中节点之间的间距?,r,graphviz,diagrammer,R,Graphviz,Diagrammer,我正在尝试使用GraphViz(即grViz())创建一个包含24个主节点和一些其他辅助节点的流程图 我希望增加节点之间的间距,以获得清晰的视图。但是它减少了每个节点中标签的字体大小,尽管我为每个节点的标签保留了fontsize=200。这就是我所做的 library( DiagrammeR ) DiagrammeR(diagram = "", type = "grViz") #.....Using GraphViz..... grViz("
fontsize=200
。这就是我所做的
library( DiagrammeR )
DiagrammeR(diagram = "", type = "grViz")
#.....Using GraphViz.....
grViz("
digraph dot {
graph[layout = dot,
rankdir = LR]
#....adding node statement for 's_o' key....
node[shape = circle, width = 20, style = filled, color = Black, fontname = Arial, fontsize = 200, penwidth = 20]
node[fillcolor = red]
's_o'
#....adding node statement for primary branching....
#....defining the primary keys.....
node[shape = box, width = 30, style = filled, color = Black, fontname = Arial, fontsize = 200, penwidth = 20]
node[fillcolor = green]
's_j'; 'f_s'; 'b_v'; 'o_c'; 'm_h'; 'a_v', 'o_o', 'm_u_ \nw_s'; 'p_u_ \n24_h'; 'b_d_ \nm'; 'm_u_ \ne_p_ \ns_p'; 's_s_p'; 's_s_p'; 'c_im_ \ns_p'; 'u_s_p'; 'v_im_ \ns_p'; 'd_f_ \ns_p'; 'm_b_f_ \n_p'; 'p_s_p'; 's_w_f_ \n_p'; 'ir_r_t_ \n10'; 'a_t_ \n10'; 'o_h_ \n24'
#.....adding edge statement for primary statement....
#.....mapping the main node with the primary nodes....
edge[arrowhead = normal, arrowsize = 10,minlen = 6, style = bold, color = Black, headclip = TRUE, tailclip = TRUE]
s_o -> {'s_j'; 'f_s'; 'b_v'; 'o_c'; 'm_h'; 'a_v', 'o_o', 'm_u_ \nw_s'; 'p_u_ \n24_h'; 'b_d_ \nm'; 'm_u_ \ne_p_ \ns_p'; 's_s_p'; 'c_im_ \ns_p'; 'u_s_p'; 'v_im_ \ns_p'; 'd_f_ \ns_p'; 'm_b_f_ \n_p'; 'p_s_p'; 's_w_f_ \n_p'; 'ir_r_t_ \n10'; 'a_t_ \n10'; 'o_h_ \n24'}
#....adding node statement for secondary branching....
#.....Defining the secondary keys for 's_j' key...
node[shape = box, height = 5, width = 12, style = filled, color = Black, fontname = Arial, fontsize = 150, penwidth = 20]
node[fillcolor = orange]
'1 : \n j'; '2 : \n j'; '...' ;
#.....From 'f_s' key...
node[shape = box, height = 5, width = 30, style = filled, color = Black, fontname = Arial, fontsize = 150, penwidth = 20]
node[fillcolor = orange]
't1 : \n 0 or c_t_v'; 'l_k_s_t'; 'h_ts';
#.....From 'b_v' key...
node[shape = box, height = 5, width = 30, style = filled, color = Black, fontname = Arial, fontsize = 150, penwidth = 20]
node[fillcolor = orange]
't1 : \n 0 or c_t_v'; 'l_k_s_t'; 'h_ts';
'b_ts'
#.....adding edge statement for secondary statement....
#.....From 's_j' key....
edge[arrowhead = normal, arrowsize = 10,minlen = 6, style = bold, color = Black, headclip = TRUE, tailclip = TRUE]
s_j -> {'1 : \n j'; '2 : \n j'; '...'}
#.....From 'f_s' key....
edge[arrowhead = normal, arrowsize = 10,minlen = 6, style = bold, color = Black, headclip = TRUE, tailclip = TRUE]
f_s -> {'t1 : \n 0 or c_t_v'; 'l_k_s_t';
'h_ts'}
#.....From 'b_v' key....
edge[arrowhead = normal, arrowsize = 10,minlen = 6, style = bold, color = Black,
headclip = TRUE, tailclip = TRUE]
b_v -> {'t1 : \n 0 or c_t_v'; 'l_k_s_t';
'h_ts'; 'b_ts'}
#....adding a graph statement.....
graph[nodesep = 2]
}
")
输出:
我猜这是因为
htmlwidgets
必须将图形压缩到一个相当小的浏览器窗口中-窗口源代码显示{“查看器”:{“宽度”:450,“高度”:350,“填充”:15,“填充”:true},“浏览器”:{“宽度”:960,“高度”:500,“填充”:40,“填充”:false}
。您可能想尝试使用“真实”graphviz生成图形。您能解释一下“真实”graphviz是什么意思吗?啊,很抱歉,我认为这是显而易见的-DiagrammeR
函数只是一个包装器,它在后台工作。它为您提供了各种输出选项(png、pdf、svg…),没有大小限制。你需要稍微编辑一下你的命令,你就可以摆脱奇怪的字体大小。我想这是因为htmlwidgets
必须将图形压缩到一个相当小的浏览器窗口中-窗口源代码说{“viewer”:{“width”:450,“height”:350,“padding”:15,“fill”:true},“browser”:{“width”:960,“height”:500,“padding”:40,“fill”:false}
。您可能想尝试使用“real”graphviz生成图形。您能解释一下“real”graphviz是什么意思吗?啊,对不起,我认为这很明显,DiagrammeR
函数只是一个包装器,它在后台工作。它为您提供了各种输出选项(png、pdf、svg…)没有大小限制。你需要稍微编辑一下你的命令,这样你就可以摆脱奇怪的字体大小。