Plotting babynames with geom_col()

Hi. Sorry to bother you again but life is full of questions. I did get the code

babynames %>% 
  group_by(sex) %>%
  top_n(5,n) %>%
  ungroup() %>%
  select(sex, name, year, n) %>% 
  arrange(sex, desc(n)) %>%
  ggplot(aes(x = name, y = n)) + geom_col()

And now I'm trying to use ggplot and geom_col to visualize the names by plot and the result is just weird. Can you please help me check what's wrong with my code? Thank you very much!

1 Like