nomnoml | R Documentation |
Renders a 'nomnoml' diagram as an 'htmlwidget' or saves it as a '.png' or '.svg' image.
nomnoml(
code = "[Hello]-[World!]",
png = NULL,
width = NULL,
height = NULL,
svg = FALSE,
...
)
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. |
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.
For a summary of available nomnoml
syntax, including association types,
directives and customer classifier styles, see nomnoml_syntax
nomnomlOutput()
, renderNomnoml()
, nomnoml_validate()
, nomnoml_syntax()
# 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]
]")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.