How to align blocks in PlantUML class diagrams?

Yuriy Kulikov picture Yuriy Kulikov · Jul 19, 2012 · Viewed 25.4k times · Source

I am using PlantUML to make simple class diagrams and the tool is awesome, but I couldn't find any way to align classes with each other except putting them into packages or using relationships like Alice -left-* Bob. What I need is something like:

@startuml  
class Bob  
class Alice  
class Dan  
**Dan aligned Alice: horizontally**  
'or using a grid?  
**Bob at grid (2, 3)**  
@enduml

Is there a way?

Answer

PlantUML picture PlantUML · Jul 19, 2012

No, there's no way to do that, sorry :( The idea behind PlantUML is that you should not care too much about the layout rendering.

Actually, early versions of PlantUML use to align classes, but it was an issue: When there were many unrelated classes, diagrams tended to be very large and very thin. So a patch was added to organize classes in a square.

How many classes do you want to have in your diagram? Sure it would be possible to disable the organizing patch for e.g. 3 to 5 classes. You could post a suggestion to the forum to see what other users think about it.