Basic Usage of the plantuml package

Overview

This package provides the functionality to create UML graphs using the PlantUML language.

Installation of plantuml binary

The package does not come with the plantuml binary, which needs to be installed as well. repeated calling of this function updates the binary.

plantuml_update()

Plotting Plantuml graphics

Define plantuml code

First, we define a plantuml object based on some plantuml code

library(plantuml)
x <- '
(*) --> "Initialization"

if "Some Test" then
  -->[true] "Some Activity"
  --> "Another activity"
  -right-> (*)
else
  ->[false] "Something else"
  -->[Ending process] (*)
endif
'
x <- plantuml(
  x
)

Plotplantuml Object

Now we plot in in a device using vector format (svg) as intermediate format, which is the default

plot(
  x = x
)

#> [1] "/tmp/RtmpVWhtpA/plantuml.b8e54b8f34c.svg"

Usage of the local server

The default server used is the offocial plantuml web server at http://www.plantuml.com/plantuml/. If yo weant to cretae the graphas locally, you have to

  1. Make sure that the plantuml file has been installed
  2. set the plantuml options to point to the local plantuml picoweb server
  3. start the plantuml picoweb server
  4. create the graphs, and
  5. when done, stop the server.

I will demonstrate this in a small example:

# 1. Make sure that the plantuml file has been installed. 
# The easiest is to use the supplied command

plantuml_update()

# 2. set the plantuml options to point to the local plantuml picoweb server

server_set("local")

# 3. start the plantuml picoweb server

server_start()

Now the following graph is created locally

plot(
  x = x
)

Finally, you should stop the server:

server_stop()

To reset the plantuml options to use the default web server, do

server_set("remote")