hafen / geofacet

R package for geographical faceting with ggplot2
https://hafen.github.io/geofacet/
Other
338 stars 45 forks source link

NA values would break the code #362

Open PursuitOfDataScience opened 2 years ago

PursuitOfDataScience commented 2 years ago

Hi,

If state has NA, it would break the code. Here I use the following example to illustrate it:

read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-02-08/airmen.csv') %>%
  count(state, pilot_type, rank_at_graduation, sort = T) %>% 
  #filter(!is.na(state)) %>%
  ggplot(aes(n, pilot_type, fill = rank_at_graduation)) +
  geom_col() +
  facet_geo(~ state, scales = "free_y")

The code breaks with the confusing error message ! The given dimensions cannot hold all panels. Please increase ncol or nrow, but when you uncomment the filter() line, it works. Not sure if this is bug, but I think it's worth mentioning.