Draws what vp_dot() describes: requirements as blue arrows (from the
feature that requires to the one required), conflicts as dashed red lines and
at-least-one lines as dotted green lines. A minimal form (vp_minimal()) is
much easier to read than the complete graphs, which have an arrow for every
consequence.
Arguments
- x
What to draw; see
vp_dot().- file
Where to save the drawing: a file ending in
.svg,.pdfor.png.NULL: no file (withengine = "graphviz", a temporary PDF file).- layout
How the nodes are placed:
"dot"(layers: best for requirements),"neato"and"fdp"(springs: best for conflicts),"sfdp"(springs, for large graphs; drawn as"fdp"by DiagrammeR),"circo"(a circle) or"twopi"(rings around a centre).- engine
"diagrammer"(the R packages DiagrammeR, DiagrammeRsvg and rsvg) or"graphviz"(the programs of Graphviz).- width, height
The size of the htmlwidget (any CSS size, or a number of pixels);
NULLlets it fill the space.- ...
More arguments of
vp_dot(), such asgraphs,features,highlight,fillorrankdir.
Details
By default the drawing is made by the package DiagrammeR, which includes its
own copy of Graphviz: nothing needs to be installed outside R. Without file
the result is an htmlwidget, which RStudio shows in its viewer and R Markdown
puts in the document. With file the drawing is saved; SVG needs the package
DiagrammeRsvg, and PDF or PNG also need rsvg. With engine = "graphviz" the
drawing is made by the programs of Graphviz, if it is installed (they are
looked for in getOption("variplex.graphviz"), the variable GRAPHVIZ, the
PATH and the usual folders), and always saved to a file.
See also
vp_dot() for the source of the drawing and the meaning of its
arguments.
Other drawing:
vp_dot(),
vp_dot_compare(),
vp_plot_compare()
Examples
band <- vp_generate(vp_example("miband3.uvl"), or_graph = TRUE)
if (requireNamespace("DiagrammeR", quietly = TRUE)) {
vp_plot(vp_minimal(band))
vp_plot(vp_minimal(band), graphs = "excludes", layout = "neato")
vp_plot(vp_feature_tree(band))
}
# \donttest{
if (requireNamespace("DiagrammeRsvg", quietly = TRUE)) {
file <- vp_plot(vp_minimal(band), file = tempfile(fileext = ".svg"))
file.exists(file)
}
#> [1] TRUE
# }