render_graph

0th

Percentile

Render the graph or output in various formats

Using a dgr_graph object, either render graph in the Viewer or output in various formats.

Usage
render_graph(graph, output = "graph", width = NULL, height = NULL)
Arguments
graph
a dgr_graph object, created using the create_graph function.
output
a string specifying the output type; graph (the default) renders the graph using the grViz function, DOT outputs DOT code for the graph, and SVG provides SVG code for the rendered graph.
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.
Aliases
  • render_graph
Examples
# Create a graph and then view it in the RStudio Viewer
nodes <-
  create_nodes(nodes = LETTERS,
               type = "letter",
               shape = sample(c("circle", "rectangle"),
                              length(LETTERS),
                              replace = TRUE),
               fillcolor = sample(c("aqua", "gray80",
                                    "pink", "lightgreen",
                                    "azure", "yellow"),
                                  length(LETTERS),
                                  replace = TRUE))

edges <-
  create_edges(from = sample(LETTERS, replace = TRUE),
               to = sample(LETTERS, replace = TRUE),
               relationship = "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_graph(graph)
Documentation reproduced from package DiagrammeR, version 0.7, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.