How to have multiple rows in a node without settin

2019-08-30 11:57发布

问题:

I need to plot nodes which have two rows. The top row is node name, and the bottom row is a condition. I am currently using the html-style table tag to achieve this. However, somehow I dislike this way. So, I am wondering if there is a more concise way without using html-style tags to do this. Note that I don't want to change rankdir=TB to rankdir=LR.

An example of my current approach, including code and output, is attached below. Thank you in advance.

digraph G {
    node [shape=Mrecord] 
    aNode [ label=<
                <table border='0'>
                <tr><td bgcolor='gray'>nodeName</td></tr>
                <tr><td>condition</td></tr></table>
                > ];
    }

回答1:

Putting {} around the text in your label will change the direction of the record separators.

digraph {
    graph [rankdir=TB];
    node [shape=Mrecord];
    item [label="{one | two}"];
}



标签: graphviz