Graphviz: make invisible node take no space -
consider graph
digraph "graph b9ca21a1-971e-400c-a7f4-cd650986476a" { graph [ margin=10 ]; node [ shape=point ]; "invisible" [ //height=0, //width=0, //margin=0, //style=invis, color="red" ]; subgraph "cluster_1" { "a"; "b"; "invisible"; "c"; "d"; } }
resulting in
i want red node invisible, taking no space, has remain there, such can used lhead
/ltail
other such miscellaneous things.
when uncommenting commented lines, result is
as see, there still spatial artifact of node.
question: there way remove completely, without affecting other nodes' layout in graph?
you can use nodesep minimize node separation (min 0.02) , instead add invisible peripheries visible nodes in order accomplish approximately equal separation of them.
here's example of how transform approximation of first graph approximation of second:
<!doctype html> <meta charset="utf-8"> <body> <script src="//d3js.org/d3.v4.min.js"></script> <script src="https://unpkg.com/viz.js@1.8.0/viz.js"></script> <script src="https://unpkg.com/d3-graphviz@0.1.2/build/d3-graphviz.min.js"></script> <div id="graph" style="text-align: center;"></div> <script> var dots = [ ` digraph "graph b9ca21a1-971e-400c-a7f4-cd650986476a" { graph [ margin=10, nodesep=0 ]; node [ shape=point, peripheries=3, penwidth=0 ]; "invisible" [ //height=0, //width=0, //margin=0, //style=invis, color="red" ]; subgraph "cluster_1" { "a"; "b"; "invisible"; "c"; "d"; } "x" [color="blue"]; "x" -> "invisible" [headclip="false"] } `, ` digraph "graph b9ca21a1-971e-400c-a7f4-cd650986476a" { graph [ margin=10, nodesep=0 ]; node [ shape=point, peripheries=3, penwidth=0 ]; "invisible" [ peripheries=0, height=0, width=0, // margin=0, // style=invis, color="red" ]; subgraph "cluster_1" { "a"; "b"; "invisible"; "c"; "d"; } "x" [color="blue"]; "x" -> "invisible" [headclip="false"] } ` ]; var dotindex = 0; var graphviz = d3.select("#graph").graphviz(); function render() { var dot = dots[dotindex % dots.length]; var transition1 = d3.transition() .delay(1000) .duration(1000 + 4000 * dotindex); graphviz .tweenshapes(false) .engine("dot") .dot(dot) .transition(transition1) .render(); dotindex += 1; transition1 .transition() .duration(0) .on('end', function () { if (dotindex != dots.length) { render(); } }); } render(); </script>
Comments
Post a Comment