# Create a graph of the flare class system
library(tidygraph)
flareGraph <- tbl_graph(flare$vertices, flare$edges) %>%
mutate(
class = map_bfs_chr(node_is_root(), .f = function(node, dist, path, ...) {
if (dist <= 1) {
return(shortName[node])
}
path$result[[nrow(path)]]
})
)
ggraph(flareGraph, 'treemap', weight = size) +
geom_node_tile(aes(fill = class, filter = leaf, alpha = depth), colour = NA) +
geom_node_tile(aes(linewidth = depth), colour = 'white') +
scale_alpha(range = c(1, 0.5), guide = 'none') +
scale_size(range = c(4, 0.2), guide = 'none')
Run the code above in your browser using DataLab