June 5, 2018

PlantUML Pleasantness: Setting Arrow Directions

PlantUML mostly does a good job organizing elements and arrows in the resulting diagram. But we can help PlantUML by defining the arrow direction in our PlantUML definition. We can use the keywords up, down, left and right inside the arrow definition.

In the following example we have five rectangles connected with arrows. We define the arrow direction for each arrow.

@startuml
rectangle Export 
rectangle PDF
rectangle HTML
rectangle ePub
rectangle Word

Export -left-> PDF
Export -right-> HTML
Export -down-> ePub
Export -up-> Word
@enduml

We can even only use the first letters of the direction. The following definition will render the same diagram:

@startuml
rectangle Export 
rectangle PDF
rectangle HTML
rectangle ePub
rectangle Word

Export -l-> PDF
Export -r-> HTML
Export -d-> ePub
Export -u-> Word
@enduml

The resulting diagram looks like this:

Written with PlantUML 1.2018.6.