⚙ Layout Engines and Options

PlantUML allows you to use several different layout engines. The following 4 apply to most diagrams.

See these 4 variants of a SAREF4CITY diagram for comparison (this is an RDF graph using the Smart Applications REFerence Ontology (SAREF) extension for Smart Cities). The source is example1-saref4city.puml and is generated from a Turtle file). The notes below are based on observing only these examples, so they are subjective.

  • Graphviz is the default engine. Relies on an external program
  • Smetana. Use !pragma layout smetana in the file or -Playout=smetana on the command-line. A port of Graphviz to Java. Tends to make slightly straighter arrows
  • VizJs uses JavaScript. Use -graphvizdot vizjs on the command line. Tends to space out nodes more, resulting in a bigger diagram.
  • ELK (Eclipse Layout Kernel). Use !pragma layout elk in the file or -Playout=elk on the command-line. Supports only orthogonal layout, and doesn't cover all features

Sequence diagrams have 2 engines:
  • "puma" is the older and still default engine
  • teoz is a new engine that has some unique features: anchors (named arrows/messages), duration, nested boxes. More features are in development (see teoz in the forum), eg parallel messages

ditaa (Ascii Art) diagrams have an optional engine:
  • noditaa replaces ditaa with java code. It's a beta release from 2019 that hasn't been updated

A number of options affect aspects of the layout. We list them below with links to forum threads:
  • #4418, #3111, #4045 !pragma svek_trace: saves dot and svg files for debugging
  • #1343 !pragma aspect: aspect ratio. May be obsolete, since aspect is not found on the graphviz attrs page, and attrs-test is missing altogether.
  • #1226 !pragma ratio: aspect ratio. Currently seems broken: specifying two numbers m,n causes graphviz error.
  • #977 skinparam nodesep: space between nodes in pixels.
  • #977 skinparam ranksep: space between node ranks.
  • #1608 skinparam linetype ortho: orthogonal layout (but label position is wrong, see plantuml/backlog#11)
  • #1608 skinparam linetype polyline: straight not curved edges
  • #4387 #5007 together: keep nodes next to each other
  • #3188 norank: edge doesn't count for the layout process
  • #8365 hidden: invisible edge that counts for the layout process
  • #4418, #1132, #3231, #3111, #3143 !pragma horizontalLineBetweenDifferentPackageAllowed: allow to make a horizontal line between packages. (Also see #1628 on layout of grouping components)
  • #1296 skinparam minClassWidth: make nodes not narrower than this
  • #1296 skinparam sameClassWidth: make all nodes the same width
  • #4637 skinparam minClassWidth on sequence diagrams
  • #2538 layout__new__line for disconnected parts of a diagram
  • #3118 skinparam padding and margin for title, footer, etc
  • #5493 skinparam ParticipantPadding and skinparam BoxPadding: padding on sequence diagrams

Achieving good layout with PlantUML is sometimes non-trivial. See PlantUML GraphViz Layout by Mark George at University of Otago for more advice.


Privacy Policy      Advertise