Graphviz: how to rotate a node (or subgraph)?

I am trying to use node (or a subgraph containing node - whichever is possible / simpler), as shown in this image:

desired rotated node effect

(Note that it doesnโ€™t matter to me if the label โ€œBโ€ is rotated - only that the โ€œverti- *โ€ texts in the record [or, more precisely, the whole record node] rotate, as shown)

However, the closest I can do is the following dot code:

 digraph graphname { node [fontname=Monospace, fontsize=14]; subgraph clusterMasterBox { node [shape=record]; l1 [label = "{ horiz-1 \r| \ horiz-2 \r| \ horiz-3 \r| \ horiz-4 \r} \ "]; subgraph clusterSubRotateBox { rotate=90; node [shape=record,rotate=90]; l2 [label = "{ verti-1 \r| \ verti-2 \r| \ verti-3 \r| \ verti-4 \r} \ "]; label="B"; } label="A" } } 

The only reason I have a subgraph clusterSubRotateBox (and the only reason it is nested inside clusterMasterBox ) is because I was hoping I could assign a rotation for it, but apparently I can't, as the above The above code generates this image:

gviz rotate actual

So my question is: is there a way to rotate the node entry; if not on its own, then perhaps as part of a subgraph (or other kind of โ€œobjectโ€)?

Thanks in advance for any suggestions,
Hooray!

+4
source share
3 answers

there must be a rotation attribute for the graph object (see http://www.graphviz.org/doc/info/attrs.html#drotation ), but it did not do anything in my test, and it will only apply to the entire graph (not a cluster / subgraph) as per the docs. I assume that you first moved the subgraph to the postscript, and then include it in the final graph as a custom form for a single node placeholder. if you cannot get a โ€œrotationโ€ to do your thing, for sure postcript has an easy way to apply the conversion (rotation in this case), perhaps as simple as prefixing the generated code with some coordinates. Sorry for the manual, but I donโ€™t have time to try now.

+3
source

If you want to rotate a single entry based on node, then rankdir will work. I tried this for my schedule,

 digraph plugnoid { rankdir=LR; node[shape=Mrecord]; plugnoid [label="swarm| {<load0> onLoad|<plugin0> Plugin|<quit0> onQuit}|{<run0>run|<rehash0>rehash}"];} 

enter image description here

The ranking can be LR, RL, and TB (default). When I changed rankdir to TB, the result changed,

enter image description here

You can try them on your schedule to get the desired results. I experienced this when I used a subgraph and set a different rank, the result was not so good. See http://www.graphviz.org/doc/info/shapes.html#record for details.

+2
source

There is an orientation attribute for one node. I just used

node[shape=hexagon, orientation=30]

Make a hexagon with a point on top, not a flat top.

Unfortunately, it looks like they are not working on record types: - (

0
source

Source: https://habr.com/ru/post/1333113/


All Articles