render_graph {DiagrammeR} | R Documentation |
Using a dgr_graph
object, either render graph in the
Viewer or output in various formats.
render_graph(graph, output = NULL, layout = NULL, width = NULL, height = NULL)
graph |
a |
output |
a string specifying the output type; |
layout |
a string specifying a layout type for a |
width |
an optional parameter for specifying the width of the resulting graphic in pixels. |
height |
an optional parameter for specifying the height of the resulting graphic in pixels. |
## Not run: # Create a graph and then view it in the RStudio Viewer nodes <- create_nodes(nodes = LETTERS, label = TRUE, type = "letter", shape = sample(c("circle", "square"), length(LETTERS), replace = TRUE), fillcolor = sample(c("aqua", "orange", "pink", "lightgreen", "black", "yellow"), length(LETTERS), replace = TRUE)) edges <- create_edges(from = sample(LETTERS, replace = TRUE), to = sample(LETTERS, replace = TRUE), rel = "letter_to_letter") graph <- create_graph(nodes_df = nodes, edges_df = edges, graph_attrs = "layout = twopi", node_attrs = c("fontname = Helvetica", "style = filled"), edge_attrs = c("color = gray20", "arrowsize = 0.5")) # Render the graph using Graphviz render_graph(graph) # Render the graph using VivaGraph render_graph(graph, output = "vivagraph") # Render the graph using visNetwork render_graph(graph, output = "visNetwork") ## End(Not run)