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 node data frame (ndf) 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)) # Create an edge data frame (edf) edges <- create_edges( from = sample(LETTERS, replace = TRUE), to = sample(LETTERS, replace = TRUE), rel = "letter_to_letter") # Create a graph object using the ndf and edf, and, # add a few attributes for the graph appearance 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)