Last active
December 18, 2015 15:36
-
-
Save abresler/0c8c3fd56b9f073a4699 to your computer and use it in GitHub Desktop.
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
# Get the latest version of 'DiagrammeR' | |
install_github("rich-iannone/DiagrammeR") | |
# Create a 'nodes' data frame | |
nodes <- sample(1:100, 100, replace = FALSE) | |
style <- rep("filled", 100) | |
fillcolor <- c(rep("turquoise", 20), rep("pink", 20), | |
rep("ochre", 20), rep("gray40", 20), | |
rep("orange", 20)) | |
nodes <- data.frame(nodes, style, fillcolor) | |
# Create a 'edges' data frame | |
edge_from <- sample(1:100, 100, replace = TRUE) | |
edge_to <- sample(1:100, 100, replace = TRUE) | |
minlen <- runif(100, 0.2, 1.2) | |
color <- rep("gray20", 100) | |
edges <- data.frame(edge_from, edge_to, minlen, color) | |
# Create the graph | |
grViz(" | |
graph two_df { | |
# Graph statements | |
graph [layout = neato, overlap = false] | |
# Node statements | |
node [label = '', shape = circle] | |
# Substitution with 'graphviz_nodes_edges_df' function | |
@@1 | |
} | |
[1]: graphviz_nodes_edges_df(nodes_df = nodes, edges_df = edges, directed = FALSE) | |
") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment