Monday 29 May 2023

PlantUML: add label to a relation in class diagram

We can add label on a relation using : followed by a label text.

 

Example

Human *-- Brain : contains

 

addLabel.txt

@startuml

title "Class Composition"

class Human

Class Brain
class Lungs
class Liver
class Heart
class Stomach
class Kidney
class Bladder

class Frontal
class Parietal
class Temporal
class Occipital

Human *-- Brain : contains
Human *-- Lungs : contains
Human *-- Liver : contains
Human *-- Heart : contains
Human *-- Stomach : contains
Human *-- Kidney : contains
Human *-- Bladder : contains

Brain *-- Frontal : contains
Brain *-- Parietal : contains
Brain *-- Temporal : contains
Brain *-- Occipital : contains

@enduml

 

Above snippet generate below diagram.

 


 

Previous                                                    Next                                                    Home

No comments:

Post a Comment