| makedot | R Documentation |
Takes a character string or vector and creates a graphviz dot flowchart from the input.
There are two kinds of input strings or lines. One defines nodes, the syntax being
nodename:string where nodename is any valid graphviz node name and string represents
a character string with possible variable value substitutions of the form {{variablename}}.
string is automatically wrapped by having newline characters inserted to keep lines
within width characters. The second kind of input line is one specifying node
connections with graphviz dot syntax, respecting node names defined in earlier strings.
Unlike makegvflow(), this approach allows a node to connect to any number of other nodes,
and allows any flow direction.
makedot(
.object.,
...,
direction = c("TD", "LR"),
shape = "box",
fontsize = 24,
nodesetup = NULL,
file,
width = 30,
onlyprint = FALSE
)
.object. |
character string or vector of plain text plus possible $LaTeX$ math delimited by single dollar signs. An empty initial line is ignore, so the user need not worry about having an initial quote mark on a line by itself. |
... |
name=value pairs that makes values replace |
direction |
direction of the flow chart, default is top-down |
shape |
node shape |
fontsize |
text font size |
nodesetup |
extra node setup to include after |
file |
name of file to hold |
width |
text width for word-wrapping |
onlyprint |
set to ```{dot}
//| label: fig-flow1
//| fig-height: 4
//| fig-cap: "Chart caption"
//| file: graphviz.dot
```
|
If a node label contains \\n, all \\n are replaced with \n and ordinary word
wrapping is suppressed. This is how users take control of line splitting.
If a node label ends in //any text, the text in any text will be copied
to inside the node definition after the label is closed with double quote and
after a space is added. This allows node colors and other attributes to be changed.
Preceed single quotes in node labels with a single backslash. Preceed double quotes with double backslashes.
The function uses knitr::knit_expand() to apply variable insertions before the diagram is rendered by Quarto. See this for an example. ##' @title makedot
nothing; used to knitr::knit_expand() graphviz markup
Frank Harrell
makegraphviz(), makegvflow()
x <- '
A:Some string of text for {{jj}}
B:Another string of test, this one being longer and needing breaking
C:A third string defining a node//style="filled,rounded", fillcolor=lightblue
A -> B
B -> C [label="some text along connecting arc"]
C -> A'
# Can also use A -> {B, C}
makedot(x, jj='tiger', onlyprint=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.