17.2 Adding parameters to plots

Graphviz substitution allows for mixing in R expressions into a Graphviz graph specification without sacrificing readability. If you specify a subsitution with @@, you must ensure there is a valid expression for that substitution. The expressions are placed as footnotes and their evaluations must result in an R vector object (i.e., not a data frame, list, or matrix). Because there is the possibility to have multiple substitutions, numbering is required. Thus, the @@ notation is immediately followed by a number and that number should correspond to the number of the footnoted R expression. For example, suppose we have a dataset which is being analysed, and we would like to identify how many values are removed at each stage of a process.

digraph graph2 {

graph [layout = dot, rankdir = LR]

# node definitions with substituted label text
node [shape = rectangle]
a [label = '@@1']
b [label = '@@2']
c [label = '@@3']
d [label = '@@4']

a -> b -> c -> d


[1]: paste('Input Data', 1)
[2]: paste('Step ', 1)
[3]: paste('Step ', 1)
[4]: paste('Step ', 1)