1 Load Packages

2 Histogram - Example 1

3 Histogram - Example 2

4 Ridgeline - Example 1

## Picking joint bandwidth of 458

5 Ridgeline - Example 2

6 Boxplot - Example 1

7 Boxplot - Example 2 - Violin, Sorted

# reorder is close to order, but is made to change the order of the factor levels.
mpg$class = with(mpg, reorder(class, hwy, median))

p <- mpg %>%
  ggplot( aes(x=class, y=hwy, fill=class)) + 
    geom_boxplot(fill="slateblue", alpha=0.1) + 
    xlab("class") +
    theme(legend.position="none") +
    xlab("")
p

8 Boxplot - Example 3 - Boxplot, Sorted

# reorder is close to order, but is made to change the order of the factor levels.
mpg$class = with(mpg, reorder(class, hwy, median))

p <- mpg %>%
  ggplot( aes(x=class, y=hwy, fill=class)) + 
    geom_violin() +
    xlab("class") +
    theme(legend.position="none") +
    xlab("")
p