- Homepage: http://plantuml.com/
- Downloads: http://plantuml.sourceforge.net/
- Source code: https://github.com/plantuml/plantuml
- Language Reference: http://plantuml.com/PlantUML_Language_Reference_Guide.pdf
Emacs version: GNU Emacs 27.1.90 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2021-01-26 org version: 9.4.5
Emacs variable org-plantuml-jar-path:/home/dfeich/.emacs.d/javalib/plantuml.jar PlantUML version 1.2021.9 (Sun Jul 25 12:13:56 CEST 2021) (GPL source distribution) Java Runtime: OpenJDK Runtime Environment JVM: OpenJDK 64-Bit Server VM Default Encoding: UTF-8 Language: en Country: US PLANTUML_LIMIT_SIZE: 4096 Dot version: dot - graphviz version 2.40.1 (20161225.0304) Installation seems OK. File generation OK
java -jar "$jpath" -help
@startuml
' this is a comment
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
John --> Alice: another Authentication Request
Alice --> John: another Authentication Response
@enduml
Note: The skin
parameter I used in the earlier versions of this document is no longer supported by plantuml.
@startuml
title Example Sequence Diagram
activate Client
Client -> Server: Session Initiation
note right: Client requests new session
activate Server
Client <-- Server: Authorization Request
note left: Server requires authentication
Client -> Server: Authorization Response
note right: Client provides authentication details
Server --> Client: Session Token
note left: Session established
deactivate Server
Client -> Client: Saves token
deactivate Client
@enduml
@startuml
actor User
participant "First Class" as A
participant "Second Class" as B
participant "Last Class" as C
User -> A: DoWork
activate A
A -> B: << createRequest >>
activate B
B -> C: DoWork
activate C
C --> B: WorkDone
destroy C
B --> A: Request <u>Created</u>
deactivate B
A --> User: Done
deactivate A
@enduml
left to right direction
actor remoteUser
actor service
rectangle Gateway {
remoteUser -- (connect camera)
(connect camera) -- service
remoteUser -- (console)
(console) -- service
}
title Servlet Container
(*) --> "ClickServlet.handleRequest()"
--> "new Page"
if "Page.onSecurityCheck" then
->[true] "Page.onInit()"
if "isForward?" then
->[no] "Process controls"
if "continue processing?" then
-->[yes] ===RENDERING===
else
-->[no] ===REDIRECT_CHECK===
endif
else
-->[yes] ===RENDERING===
endif
if "is Post?" then
-->[yes] "Page.onPost()"
--> "Page.onRender()" as render
--> ===REDIRECT_CHECK===
else
-->[no] "Page.onGet()"
--> render
endif
else
-->[false] ===REDIRECT_CHECK===
endif
if "Do redirect?" then
->[yes] "redirect request"
--> ==BEFORE_DESTROY===
else
if "Do Forward?" then
-left->[yes] "Forward request"
--> ==BEFORE_DESTROY===
else
-right->[no] "Render page template"
--> ==BEFORE_DESTROY===
endif
endif
--> "Page.onDestroy()"
-->(*)
Swimlanes actually are activity diagrams using the new syntax.
@startuml
|Swimlane1|
start
:foo1;
|#AntiqueWhite|Swimlane2|
:foo2;
:foo3;
|Swimlane1|
:foo4;
|Swimlane2|
:foo5;
stop
@enduml
http://plantuml.sourceforge.net/classes.html
class Proposal {
also called a "study"
..
ProposalID
Proposer
PrincipalInvestigator
}
class Visit << (V,#Ff8c00) >> {
has a 1:1 mapping to a
single user. Also used to
reserve badges.
..
Username
starttime
endtime
proposalID
beamline
}
note left: why is Visit linked\nto a single beamline?
class Shift {
ProposalID
starttime
endtime
contactPerson
}
Proposal *-- Shift
Proposal *-- Visit
@startuml
package "Some Group" {
HTTP - [First Component]
[Another Component]
}
node "Other Groups" {
FTP - [Second Component]
[First Component] --> FTP
}
cloud {
[Example 1]
}
database "MySql" {
folder "This is my folder" {
[Folder 3]
}
frame "Foo" {
[Frame 4]
}
}
[Another Component] --> [Example 1]
[Example 1] --> [Folder 3]
[Folder 3] --> [Frame 4]
@enduml
The next example was posted by Cecil Westerhof on emacs-orgmode.gnu.org mailing list [2019-10-18 Fri]
@startuml
component [Producer 1\nProducer 2\nProducer ...\nProducer n] as Producers
cloud {
[Internet] as Internet1
}
node RabbitMQ #LightSteelBlue {
[Exchange]
[Queue 1\nQueue 2\nQueue ...\nQueue n] as Queues
}
cloud {
[Internet] as Internet2
}
[Consumer 1\nConsumer 2\nConsumer ...\nConsumer n] as Consumers
[Producers] -> [Internet1] : Publish
[Internet1] -> [Exchange] : Publish
[Exchange] -> [Queues] : Route
[Queues] -> [Internet2] : Consume
[Internet2] -> [Consumers] : Consume
@enduml
- [2019-07-21 Sun] Needs plantuml-1.2019.08 or newer. Still in testing and features may change
- http://plantuml.com/mindmap-diagram
- Nice Link about mindmaps in PlantUML: http://hangaroundtheweb.com/2019/07/mind-maps-in-spacemacs/
The examples are taken from the official plantuml page.
This syntax looks like the most versatile and useful to me
- Leading “+/-” specify hierarchy level and whether the node is on the right or left of the central node.
- Undescores directly following the leading position characters prevent the creation of a box around an item.
@startmindmap + OS ++ Ubuntu +++_ Linux Mint +++_ Kubuntu +++_ Lubuntu +++_ KDE Neon ++ LMDE ++ SolydXK ++ SteamOS ++ Raspbian -- Windows 95 -- Windows 98 -- Windows NT ---_ Windows 8 ---_ Windows 10 @endmindmap
A mindmap based on org mode syntax. Note that the org headline asterisks need to be escaped by “,” inside of a source block. It’s nice that they allow for an org mode syntax, but I think this is less convenient to write and work with. The org headlines do not allow for text following them (syntax error).
@startmindmap
* Debian
** Ubuntu
*** Linux Mint
*** Kubuntu
*** Lubuntu
*** KDE Neon
** LMDE
** SolydXK
** SteamOS
** Raspbian with a very long name
*** <s>Raspmbc</s> => OSMC
*** <s>Raspyfi</s> => Volumio
@endmindmap
@startmindmap
caption figure 1
title My super title
* <&flag>Debian
** <&globe>Ubuntu
*** Linux Mint
*** Kubuntu
*** Lubuntu
*** KDE Neon
** <&graph>LMDE
** <&pulse>SolydXK
** <&people>SteamOS
** <&star>Raspbian with a very long name
*** <s>Raspmbc</s> => OSMC
*** <s>Raspyfi</s> => Volumio
header
My super header
endheader
center footer My super footer
legend right
Short
legend
endlegend
@endmindmap
@startuml
scale 1.5
nwdiag {
network dmz {
address = "210.x.x.x/24"
// set multiple addresses (using comma)
web01 [address = "210.x.x.1, 210.x.x.20"];
web02 [address = "210.x.x.2"];
}
network internal {
address = "172.x.x.x/24";
web01 [address = "172.x.x.1"];
web02 [address = "172.x.x.2"];
db01;
db02;
}
}
@enduml
Regrettably rackdiag is not yet ([2021-08-18 Wed]) part of the functionality that was integrated in plantuml from nwdiag. q.v. http://blockdiag.com/en/nwdiag/rackdiag-examples.html
@startuml
scale 1.5
rackdiag {
// define height of rack
16U;
// define rack items
1: UPS [2U];
3: DB Server
4: Web Server
5: Web Server
6: Web Server
7: Load Balancer
8: L3 Switch
}
@enduml
https://plantuml.com/wbs-diagram
@startwbs
+[#SkyBlue] New Job
++ Decide on Job Requirements
+++ Identity gapsy
+++ Review JDs
++++ Sign-Up for courses
++++ Volunteer
++++ Reading
++- Checklist
+++- Responsibilities
+++- Location
++ CV Upload Done
+++ CV Updated
++++ Spelling & Grammar
++++ Check dates
---- Skills
+++ Recruitment sites chosen
@endwbs
@startwbs
' skinparam backgroundColor blue
<style>
wbsDiagram {
.pink {
BackgroundColor pink
}
.your_style_name {
BackgroundColor SkyBlue
}
}
</style>
+ this is the partner workpackage <<your_style_name>>
++ this is my workpackage <<pink>>
++ this is another workpackage
@endwbs
@startwbs
<style>
node {
Padding 12
Margin 3
HorizontalAlignment center
LineColor blue
LineThickness 3.0
BackgroundColor gold
RoundCorner 40
MaximumWidth 100
}
rootNode {
LineStyle 8.0;3.0
LineColor red
BackgroundColor white
LineThickness 1.0
RoundCorner 0
Shadowing 0.0
}
leafNode {
LineColor gold
RoundCorner 0
Padding 3
}
arrow {
LineStyle 4
LineThickness 0.5
LineColor green
}
</style>
+ Hi =)
++ sometimes i have node in wich i want to write a long text
+++ this results in really huge diagram
++++ of course, i can explicit split with a\nnew line
++++ but it could be cool if PlantUML was able to split long lines, maybe with an option who specify the maximum width of a node
@endwbs
Which skinparam can be used to change font size?
@startwbs
skinparam classFontSize 30
' skinparam backgroundColor blue
<style>
wbsDiagram {
.pink {
BackgroundColor pink
}
.your_style_name {
BackgroundColor SkyBlue
}
}
</style>
+ this is the partner workpackage <<your_style_name>>
++ this is my workpackage <<pink>>
++ this is another workpackage
@endwbs
https://plantuml.com/preprocessing
The simple preprocessor allows the definition of variables and functions. Some standard functions like %date are already provided.
@startuml
scale 1.5
!function $inc($value, $step=1)
!return $value + $step
!endfunction
Alice -> Bob : Just one more $inc(3)
Alice -> Bob : Add two to three : $inc(3, 2)
center footer generated on %date("yyyy.MM.dd 'at' HH:mm")
@enduml
Minimally adapted from https://blog.jdriven.com/2017/10/plantuml-pleasantness-use-gradients-diagrams/
@startuml
title Gradient
skinparam defaultTextAlignment center
skinparam RectangleFontSize 20
skinparam TitleFontStyle bold
skinparam TitleFontColor #e723e7
' Define two colors for a gradient of the background
' and use "-" to define that the gradient goes from top to bottom.
skinparam BackgroundColor #000000-#afafaf
' Define two colors for a default background gradient of Rectangles
' and use / for top left to bottom right.
skinparam RectangleBackgroundColor #ffd200/#8cfcff
rectangle A [
From top left
to bottom right
<&fullscreen-enter>
]
' Use "\" for bottom left to top right
rectangle B #ffd200\8cfcff [
From bottom left
to top right
<&resize-both>
]
' Use "|" for left to right
rectangle C #ffd200|8cfcff [
From left
to right
<&resize-width>
]
' Use "-" for top to bottom
rectangle D #ffd200-8cfcff [
From top
to bottom
<&resize-height>
]
@enduml
The available default colors can be displayed using this snippet
@startuml
colors
@enduml
@startuml
scale 2
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
John --> Alice: another Authentication Request
Alice --> John: another Authentication Response
@enduml
The svg package uses inkscape to separate the text and graphical elements of the SVG into a Tex file (*.pdf_tex) and a PDF file containig the graph elements. E.g. svg-sequence1.svg into svg-sequence1.pdf_tex and svg-sequence1.pdf.
Currently, SVG pictures can only be rendered correctly, if the picture is in the same directory as the tex source file (and therefore also the org source file).
Note: with the current org version 9.1.14 and Emacs 26.1 the SVG is not correctly displayed in the org buffer, but the SVG renders fine in the exported Latex PDF.
@startuml
' this is a comment
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
John --> Alice: another Authentication Request
Alice --> John: another Authentication Response
@enduml