geofacet icon indicating copy to clipboard operation
geofacet copied to clipboard

NA values would break the code

Open PursuitOfDataScience opened this issue 3 years ago • 0 comments

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.

PursuitOfDataScience avatar Feb 08 '22 14:02 PursuitOfDataScience