hrbrmstr / hrbrthemes

:lock_with_ink_pen: Opinionated, typographic-centric ggplot2 themes and theme components
Other
1.23k stars 96 forks source link

Dot Plots in hrbrthemes #53

Closed seabass011 closed 4 years ago

seabass011 commented 4 years ago

Hi Bob! Would you be open to giving me pointers on how to add a dotplot to hrbrthemes? Would love to show dot plots for displaying amounts where there are more than six categories.

Would love to get your thinking here!

Let me know! 😃

Source: Example is on Page 54 from Fundamentals of Data Visualization: A Primer on Making Informative and Compelling Figures by Claus O. Wilke and I hold no copyright.

seabass011 commented 4 years ago

Screen Shot 2020-04-28 at 10 16 54 PM

hrbrmstr commented 4 years ago

Dr Wilke does not provide examples in the book?

hrbrmstr commented 4 years ago
library(gapminder)
library(hrbrthemes)
library(tidyverse)

filter(gapminder, grepl("Amer", continent), year == 2007) %>% 
  arrange(lifeExp) %>% 
  mutate(country = fct_inorder(as.character(country))) %>% 
  ggplot() +
  geom_point(
    aes(lifeExp, country),
    color = "steelblue", size = 2
  ) +
  labs(
    x = "Life Expectancy (Years)", y = NULL
  ) +
  theme_ipsum_es(grid="XY")

image

hrbrmstr commented 4 years ago

i sure hope this wasn't homework. those q's are for stackoverflow.

seabass011 commented 4 years ago

Great! For some reason, I thought it was a different chart type. I'll learn from this and ask these sorts of q's on stack overflow in the future. Appreciate all the great work on hrbrthemes. 😃