GraphViz - How to have a subgraph be left-to-right when main graph is top-to-bottom?

前端 未结 5 1934
梦毁少年i
梦毁少年i 2021-02-01 16:31

I have a graph file like this:

digraph {
    \"Step1\" -> \"Step2\" -> \"Step3\";

    subgraph step2detail {
        \"Step2\" -> \"note1\";
        \"         


        
5条回答
  •  温柔的废话
    2021-02-01 17:11

    The trick to get the graph you described is to use two subgraphs and link from one to the other. The invisible edges in "details" are what keep the notes aligned.

    digraph {
        rankdir="LR";
    
        subgraph steps {
            rank="same";
            "Step1" -> "Step2" -> "Step3";
        }
    
        subgraph details {
            rank="same";
            edge[style="invisible",dir="none"];
            "note1" -> "note2" -> "note3" -> "note4";
        }
    
        "Step2" -> "note1";
        "Step2" -> "note2";
        "Step2" -> "note3";
        "Step2" -> "note4";
    }
    

    The result is:

提交回复
热议问题