thomasp85 / ggraph

Grammar of Graph Graphics

Home Page:https://ggraph.data-imaginist.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in facet_graph with one dimension

eveyp opened this issue · comments

I'm getting an error everytime I try to use facet_graph() with only one dimension. These plots work fine with facet_grid() instead of facet_graph() so I'm not sure what the issue is.

Here's an example that leads to the error:

library(ggraph)
library(tidygraph)
library(tibble)

nodes = tibble(
  id = 1:10,
  type = c(rep("A", 3), rep("B", 1), rep("C", 6))
)

edges = tibble(
  from = c(1, 5, 6, 7, 9),
  to =   c(2, 7, 8, 9, 10)
)

tbl_graph(nodes, edges) %>% 
  ggraph(layout = "tree", flip.y = FALSE) +
  geom_node_point() +
  geom_edge_link() +
  facet_graph(type ~ ., row_type = "node", scales = "free_y", space = "free")