Skip to contents

This function is called inside text_drake_graph(), which typical users call more often. See ?text_drake_graph for details.

Usage

render_text_drake_graph(graph_info, nchar = 1L, print = TRUE)

Arguments

graph_info

List of data frames generated by drake_graph_info(). There should be 3 data frames: nodes, edges, and legend_nodes.

nchar

For each node, maximum number of characters of the node label to show. Can be 0, in which case each node is a colored box instead of a node label. Caution: nchar > 0 will mess with the layout.

print

Logical. If TRUE, the graph will print to the console via message(). If FALSE, nothing is printed. However, you still have the visualization because text_drake_graph() and render_text_drake_graph() still invisibly return a character string that you can print yourself with message().

Value

The lines of text in the visualization.

Examples

if (FALSE) { # \dontrun{
isolate_example("Quarantine side effects.", {
if (suppressWarnings(require("knitr"))) {
load_mtcars_example() # Get the code with drake_example("mtcars").
pkgs <- requireNamespace("txtplot", quietly = TRUE) &&
  requireNamespace("visNetwork", quietly = TRUE)
if (pkgs) {
# Instead of jumpting right to vis_drake_graph(), get the data frames
# of nodes, edges, and legend nodes.
text_drake_graph(my_plan) # Jump straight to the interactive graph.
# Get the node and edge info that vis_drake_graph() just plotted:
graph <- drake_graph_info(my_plan)
# You can pass the data frames right to render_text_drake_graph().
render_text_drake_graph(graph)
}
}
})
} # }