R/plot_graph.R
To save time for repeated plotting,
this function is divided into
dataframes_graph()
and render_drake_graph()
.
vis_drake_graph(config = drake::read_drake_config(), file = character(0), selfcontained = FALSE, build_times = "build", digits = 3, targets_only = FALSE, split_columns = FALSE, font_size = 20, layout = "layout_with_sugiyama", main = NULL, direction = "LR", hover = TRUE, navigationButtons = TRUE, from = NULL, mode = c("out", "in", "all"), order = NULL, subset = NULL, ncol_legend = 1, full_legend = TRUE, make_imports = TRUE, from_scratch = FALSE, ...)
config | a |
---|---|
file | Name of HTML file to save the graph.
If |
selfcontained | logical, whether
to save the |
build_times | character string or logical.
If character, the choices are
1. |
digits | number of digits for rounding the build times |
targets_only | logical, whether to skip the imports and only include the targets in the workflow plan. |
split_columns | logical, whether to break up the columns of nodes to make the aspect ratio of the rendered graph closer to 1:1. This improves the viewing experience, but the columns no longer strictly represent parallelizable stages of build items. (Although the targets/imports in each column are still conditionally independent, there may be more conditional independence than the graph indicates.) |
font_size | numeric, font size of the node labels in the graph |
layout | name of an igraph layout to use, such as 'layout_with_sugiyama' or 'layout_as_tree'. Be careful with 'layout_as_tree': the graph is a directed acyclic graph, but not necessarily a tree. |
main | character string, title of the graph |
direction | an argument to |
hover | logical, whether to show the command that generated the target when you hover over a node with the mouse. For imports, the label does not change with hovering. |
navigationButtons | logical, whether to add navigation buttons with
|
from | Optional collection of target/import names.
If |
mode | Which direction to branch out in the graph
to create a neighborhood around |
order | How far to branch out to create
a neighborhood around |
subset | Optional character vector of of target/import names.
Subset of nodes to display in the graph.
Applied after |
ncol_legend | number of columns in the legend nodes.
To remove the legend entirely, set |
full_legend | logical. If |
make_imports | logical, whether to make the imports first.
Set to |
from_scratch | logical, whether to assume all the targets
will be made from scratch on the next |
... | arguments passed to |
A visNetwork graph.
# NOT RUN { test_with_dir("Quarantine side effects.", { config <- load_basic_example() # Get the code with drake_example("basic"). # Plot the network graph representation of the workflow. vis_drake_graph(config, width = '100%') # The width is passed to visNetwork config <- make(my_plan) # Run the project, build the targets. vis_drake_graph(config) # The red nodes from before are now green. # Plot a subgraph of the workflow. vis_drake_graph( config, from = c("small", "reg2"), to = "summ_regression2_small" ) }) # }