From 40c27dad0a4d6f38955815134418d4452d43ab07 Mon Sep 17 00:00:00 2001 From: Saul Shanabrook Date: Sat, 17 Jun 2023 18:12:18 -0400 Subject: [PATCH] Add another cluster nesting to increase margin --- src/graph/to_graphviz.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/graph/to_graphviz.rs b/src/graph/to_graphviz.rs index 718eadda5..52a094d60 100644 --- a/src/graph/to_graphviz.rs +++ b/src/graph/to_graphviz.rs @@ -188,14 +188,20 @@ fn build_graph(nodes: Nodes, edges: Edges, sort_colors: &SortColors) -> Graph { let color = sort_colors[&sort]; stmts.push(stmt!(attr!("fillcolor", color))); for (subgraph_id, nodes) in subgraphs { - // Nest in empty sub-graph so that we can use rank=same - // https://stackoverflow.com/a/55562026/907060 let quoted_subgraph_id = quote(&subgraph_id); let subgraph_stmts = nodes.into_iter().map(|s| stmt!(s)).collect(); - let s = stmt!(subgraph!(quoted_subgraph_id; + let s = stmt!(subgraph!(""; // Disable label for now, to reduce size // NodeAttributes::label(subgraph_html_label(&sort)), - subgraph!("", subgraph_stmts) + + // Nest in empty sub-graph so that we can use rank=same + // https://stackoverflow.com/a/55562026/907060 + subgraph!(quoted_subgraph_id; subgraph!("", subgraph_stmts)), + + // Make outer subgraph a cluster but make it invisible, so just used for padding + // https://forum.graphviz.org/t/how-to-add-space-between-clusters/1209/3 + SubgraphAttributes::style(quote("invis")), + attr!("cluster", "true") )); stmts.push(s); }