Skip to contents

[Experimental]

Renders a 'nomnoml' diagram as an 'htmlwidget' or saves it as a '.png' or '.svg' image.

Usage

nomnoml(
  code = "[Hello]-[World!]",
  png = NULL,
  width = NULL,
  height = NULL,
  svg = FALSE,
  ...
)

Arguments

code

The nomnoml diagram code.

png

Optional file name to export diagram as 'png'.

width

Optional width in pixels for the exported 'png'.

height

Optional height in pixels for the exported 'png'.

svg

Use 'svg' output instead of 'png'? Notice that rendering in 'svg' is not at a par with 'png' and renders incorrectly at times.

...

Additional parameters.

Details

The 'nomnoml' syntax is simple and intuitive, a "Hello World" example can be rendered as an 'htmlwidget' as follows:

nomnoml::nomnoml("[Hello]-[World!]")

You can also render as a 'png' file with specific dimensions:

nomnoml::nomnoml("[Hello]-[World!]", png = "hello.png", 600, 100)

Still, complex diagrams can be defined by combining multiple association types, classifier types, directives and custom classifier styles.

You can also use of the nomnoml 'knitr' chunk to render inline diagrams in R Markdown documents.

Syntax

For a summary of available nomnoml syntax, including association types, directives and customer classifier styles, see nomnoml_syntax

Examples

# Render simple diagram:
nomnoml::nomnoml("[Hello]-[World!]")
# Render complex diagram: nomnoml::nomnoml(" #stroke: #a86128 [<frame>Decorator pattern| [<abstract>Component||+ operation()] [Client] depends --> [Component] [Decorator|- next: Component] [Decorator] decorates -- [ConcreteComponent] [Component] <:- [Decorator] [Component] <:- [ConcreteComponent] ]")