Wednesday, 1 January 2020

Code for making a color pack visualization in R using flare dataset

library(ggraph)
library(igraph)
library(tidyverse)
# We need a data frame giving a hierarchical structure. Let's consider the flare dataset:
edges <- flare$edges

# Usually we associate another dataset that give information about each node of the dataset:
vertices <- flare$vertices

# Then we have to make a 'graph' object using the igraph library:
mygraph <- graph_from_data_frame( edges, vertices = vertices )

# Make the plot
ggraph(mygraph, layout = 'circlepack') +
  geom_node_circle() +
  theme_void()

ggraph(mygraph, 'treemap', weight = size) +
  geom_node_tile(aes(fill = depth), size = 0.25) +
  theme_void() +
  theme(legend.position="none")




No comments:

Post a Comment

what is a good PhD contribution?

When PhD candidates embark on their thesis journey, the first thing they will likely learn is that their research must be a “significant ori...