--- title: "Basic Usage of the `plantuml` package" author: "Vignette Author" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Basic Usage of the `plantuml` package} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(plantuml) ``` # Overview This package provides the functionality to create UML graphs using the [PlantUML](https://plantuml.com/) 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. ```{r installation_plantuml, eval = FALSE} plantuml_update() ``` # Plotting Plantuml graphics ## Define plantuml code First, we define a plantuml object based on some plantuml code ```{r definePlantuml} 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 ```{r exampleDeviceVector} plot( x = x ) ``` ## Usage of the local server The default server used is the offocial plantuml web server at [http://www.plantuml.com/plantuml/](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: ```{r local, eval = FALSE, echo = TRUE} # 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 ```{r plotlocal, eval = FALSE, echo = TRUE} plot( x = x ) ``` Finally, you should stop the server: ```{r stopserver, eval = FALSE, echo = TRUE} server_stop() ``` To reset the plantuml options to use the default web server, do ```{r resetserver, eval = FALSE, echo = TRUE} server_set("remote") ```