Visualization Best Practices in R
Nick Strayer
Instructor
ggplot(md_speeding, aes(x = speed_over)) +
geom_histogram() +
facet_grid(vehicle_color ~ .)
geom_jitter()
shows raw points jostled to avoid overlap.geom_boxplot()
.md_speeding %>%
filter(vehicle_color == 'BLUE') %>%
ggplot(aes(x = gender, y = speed)) +
# Draw points behind
geom_jitter(alpha = 0.3, color = 'steelblue') +
# Make transparent
geom_boxplot(alpha = 0) +
labs(title = 'Distribution of speed for blue cars by gender')
Visualization Best Practices in R