1

我正在尝试使用 GraphViz 即 grViz() 创建一个包含 24 个主节点和一些其他辅助节点的流程图。

我希望增加节点之间的间隙以获得清晰的视图。但它减少了每个节点中标签的字体大小,尽管我保留了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]

          }        

          ")

输出 :

此代码的输出

4

0 回答 0