Package 'nomnomlgraph'

Title: Create nomnoml diagrams in R based on data frames with nodes and edges
Description: Create nomnoml diagrams in R based on data frames with nodes and edges.
Authors: Giorgio Comai [aut, cre, cph]
Maintainer: Giorgio Comai <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9001
Built: 2024-10-24 04:13:35 UTC
Source: https://github.com/giocomai/nomnomlgraph

Help Index


Create a diagram with nomnoml based on edges and nodes

Description

Available association types to be used in the edges data frame:

Usage

nn_graph(
  nodes,
  edges,
  output = "diagram",
  direction = "down",
  lineWidth = 1,
  fill = "#FEFEFF",
  zoom = 4,
  arrowSize = 1,
  bendSize = 0.3,
  gutter = 5,
  edgeMargin = 0,
  edgesStyle = "hard",
  fillArrows = "false",
  font = "sans",
  fontSize = 12,
  leading = 1.25,
  padding = 8,
  spacing = 40,
  stroke = "#33322E",
  title = "filename",
  png = NULL,
  width = NULL,
  height = NULL,
  svg = FALSE
)

Arguments

nodes

A data frame with two columns: id, text, and an optional classifier.

edges

A data frame with three columns: from, to, and association.

output

Defaults to "diagram". Valid values are either "diagram" or "code".

direction

Defaults to "down". Valid values are either "down" or "right".

fill

Defaults to "#FEFEFF". Values commonly used by nomnoml inlcude "#eee8d5" and "#fdf6e3".

edgesStyle

Defaults to "hard". Valid values are either "hard" or "rounded". Value is passed to nomnoml as "edges".

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.

Details

  • association -> association <-> association –> dependency <–> dependency -:> generalization <:- generalization –:> implementation <:– implementation +- composition +-> composition o- aggregation o-> aggregation – note -/- hidden

Value

An object with class nomnoml and htmlwidget. By default, it the diagram is printed.

Examples

nodes <- tibble::tribble(
  ~id, ~text,
  1, "Starting point",
  2, "Other starting point",
  3, "This is where things merge",
  4, "This is where things go"
)


edges <- tibble::tribble(
  ~from, ~to, ~association,
  1, 3, "-",
  2, 3, "-",
  3, 4, "->"
)

nn_graph(
  nodes = nodes,
  edges = edges,
  fill = "#fdf6e3",
  edgesStyle = "rounded",
  # font = "Roboto Condensed",
  fillArrows = "false",
  svg = TRUE
)