what data format is necessary to create ggraph circlepack layout? It seems to require a hierarchy.
I tried normally vertices and nodes, which apparently doesn't work.
library(ggraph)
library(igraph)
edges=data.frame(from=c('a','b','c'), to= c('c','a','d'))
vertices=data.frame(nodes=c('a','b','c','d'), weight=c(1,2,3,4))
graph <- graph_from_data_frame(edges, vertices = vertices)
ggraph(graph, 'circlepack', weight = 'size') +
geom_node_circle(size = 0.25, n = 50) +
coord_fixed()
I then tried a dendrogram object which doesn't work either. If i want to show several groups with sub-items in packed circle, how shall i build the graph object?
the data frame is more like this
df <- data.frame(group=c("a","a","b","b","b"), subitem=c("x","y","z,"u","v"), size=c(6,2,3,2,5))