devtools::install_github("rich-iannone/DiagrammeR")Overview
- This section is based on the official documentation of
DiagrammeR. - This html widget is developed by Richard Iannone.
- The DiagrammeR package allows create, modify, analyze, and visualize network graph diagrams
1 Installation
or
install.packages("DiagrammeR")2 Start from scratch
Use create_graph to start with a empty graph object and use add_node() and add_edge functions to add nodes and edges, respectively.
library(DiagrammeR)
create_graph() |>
add_node() |>
add_node() |>
add_edge(from = 1, to = 2) |>
render_graph(layout = "nicely")3 aesthetic for node and edge
Use node_aes() inside add_node and edge_aes() inside add_edge to specify aesthetic attributes.
| Aesthetic | Attributes |
|---|---|
| Node | color |
| fillcolor | |
| fontcolor | |
| Edge | color |
| arrowhead | |
| tooltip |