Hi there I want to have a uml sequence diagram with dot language, now I have the following problem I want to have the layout as follows with a, b, c and d in a straight line at top but with the lines going straight to the bottom. How can I achieve that?
a b c d
| | | |
| | | |
perhaps can I achieve that the a, b, c and d with its belonging edges are clusters where I set a different rankdir for the clusters?
EDIT Just found a solution by adding invisible edges between a, b, c and d but any other solutions?
You could try mscgen (message sequence chart generator)
A simple diagram would be example.msc
msc {
A,B;
--- [label="Start", ID="1"];
A->B [label="signal"]; A<-B [label="signal"];
}
$: mscgen -T png -o example.png -i example.msc.
Thats it is generates nice sequence diagram.
Thanks, Srikanth Kyatham
What you describe seems to be what
dot
does by default.For example, this graph:
Comes out like this:
If you have a more complex graph you can force nodes to be at the same height using
rank=same
. For example:Comes out like this:
However, if you want
a
,b
,c
andd
to be in a specific order I think you're going to have to use invisible edges like you suggested. Thedot
guide even recommends this:Suggestion #1 - PlantUML
PlantUML uses Graphviz, so one option is to simply use PlantUML. For example, in PlantUML this...
...is rendered as this...
The above diagram was rendered at http://plantuml.com/plantuml/..., and you can read up on PlantUML sequence diagrams in the documentation. Also, PlantUML can also be used from the command line, and PlantUML plugins are available for many popular IDEs.
Suggestion #2 - NEATO
You can also use Graphviz & NEATO (PDF). For example, this directed graph...
And rendering it via NEATO (which is installed with Graphviz) from the command line...
...is rendered as this...
To use NEATO to render the above image, do you the following:
$ brew install graphviz # requires Homebrew
)digraph sequenceDiagramExample {...}
code from above in a text file calledsequenceDiagramExample.dot
$ neato -Tpng sequenceDiagramExample.dot -o sequenceDiagramExample.png
, which will generate a PNG file calledsequenceDiagramExample.png
Pro-tip - Don't confuse the
neato
withdot
executablesneato
is probably what you want to use when you want granular control over how elements are positioned (alternate viewpoints in comments welcome!)neato
vs. rendering withdot
(which is also included with Graphviz)dot
(e.g.$ dot -Tpng sequenceDiagramExample.dot -o sequenceDiagramExample.png
) will produce this...