starwars |>count(hair_color, name ="no_of_characters") |>ggplot(aes(x= hair_color, y= no_of_characters)) +geom_col()
Create Facets
We can split graphs by another categorical or discrete variable.
starwars |>ggplot(aes(x = hair_color))+geom_bar() +facet_wrap(~gender)+theme(axis.text.x =element_text(angle =90)) # rotating text so its easier to read
Too many facets
Be careful too many facets can obscure the visualization.