Making a Legend/Key in GraphViz

前端 未结 6 1420
失恋的感觉
失恋的感觉 2020-12-12 12:28

I’d like to include a legend or key in my GraphViz diagram. I’m having trouble figuring out what code to use, though. I also want to put it in a corner, but the only coord I

6条回答
  •  春和景丽
    2020-12-12 13:11

    I had some luck with the following. I didn't like how wide it was, but otherwise it worked.

       subgraph cluster1 {
            label = "Legend" ;
            shape=rectangle ;
            color = black ;
            a [style=invis];
            b [style=invis] ;
            c [style=invis] ;
            d [style=invis] ;
            c -> d [label="only ts", style=dashed, fontsize=20] ; 
            a -> b [label="ts and js", fontsize=20] ;
            gui -> controller [style=invis] ;
            view -> model [style=invis] ;
            builtins -> utilities [style=invis] ;
    
            gui [style=filled, fillcolor="#ffcccc"] ;
            controller [style=filled, fillcolor="#ccccff"] ;
            view [style=filled, fillcolor="#ccffcc"] ;
            model [style=filled, fillcolor="#ffccff"] ;
            builtins [style=filled, fillcolor="#ffffcc"] ;
            utilities ;
            "external libraries" [shape=rectangle] ;
        }
    

    The result was

提交回复
热议问题