Error using geom_conn_bundle()

When trying to use geom_conn_bundle() I systematically get this error:

Error in geom_conn_bundle():
! Problem while computing layer data.
:information_source: Error occurred in the 1st layer.
Caused by error in layer_data():
! layer_data() must return a <data.frame>

Not sure it's relevant, but I'm using R 4.2.1 on an Ubuntu 22.04 machine. The ggraph package is updated to the last CRAN version. Below a minimal example causing the error.

library(tidygraph)
library(ggraph)

graph <- as_tbl_graph(highschool) |> 
  mutate(Popularity = centrality_degree(mode = 'in'))

ggraph(graph, layout = 'kk') + 
  geom_conn_bundle() +
  geom_node_point()

geom_conn_bundle() needs data from get_con(), something like

graph <- as_tbl_graph(highschool)
importFrom <- match(highschool$from, highschool$to)
importFrom <- match(highschool$to, highschool$from)
ggraph(graph, 'kk') + 
  geom_node_point()+
  geom_conn_bundle(data = get_con(importFrom, importTo))

Thank you. I understand the problem now.
I decided to use the edgebundle package instead, which offer more flexibility in the type of bundle to implement (I love the 'hammer' one, see https://github.com/schochastics/edgebundle)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.