Weight must be numeric while trying Circle packing on R GGRAPH

Viewed 336

i've seen already the topic on the subjet with this issue :

library(ggraph)
library(igraph)
edges <- flare$edges
vertices <- flare$vertices
mygraph <- graph_from_data_frame(edges, vertices=vertices)

ggraph(mygraph, layout = 'circlepack', weight = 'size')
Error in tree_to_hierarchy(graph, direction, sort.by, weight) :
Weight must be numeric

Removing the quotations on size doesn't do the trick for me and it's the only solution i found so far !

Thank you for your help.

2 Answers

The ggraph package follow the ggplot2 logic. Are you looking for something like this ?

ggraph(graph, 'circlepack',weight=size) + 
    geom_node_circle( n = 50) + 
    coord_fixed()

enter image description here

EDIT: I have the R version: 4.0.0

And to get the version of ggraph, you can do: packageVersion("ggraph") and I have 2.0.3.

Ok apparently the problem comes from the fact that values can't worth 0 so i need to add a small value to them or to remove them.

Related