Last active
October 2, 2015 03:34
-
-
Save rich-iannone/fa52046b4867fb8c5d07 to your computer and use it in GitHub Desktop.
Fixed nodes (with specified positions) in DiagrammeR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Installation | |
#install.packages("devtools") | |
devtools::install_github("rich-iannone/DiagrammeR") | |
library(DiagrammeR) | |
# Create and render an empty graph | |
empty_graph <- create_graph() | |
render_graph(empty_graph, output = "visNetwork") | |
# Create a graph with positioned nodes | |
nodes <- | |
create_nodes(nodes = c("a", "b", "c"), | |
label = TRUE, | |
x = c(0, 120, 240), | |
y = c(0, 120, 240)) | |
graph <- create_graph(nodes_df = nodes) | |
render_graph(graph, output = "visNetwork") | |
# Create a graph with positioned nodes and edges | |
nodes <- | |
create_nodes(nodes = c("a", "b", "c"), | |
label = TRUE, | |
x = c(0, 120, 240), | |
y = c(0, 120, 240)) | |
edges <- | |
create_edges(from = c("a", "b"), | |
to = c("b", "c"), | |
rel = c("rel_a", "rel_b"), | |
width = c(1, 3)) | |
graph <- create_graph(nodes_df = nodes, | |
edges_df = edges) | |
render_graph(graph, output = "visNetwork") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment