Load Packages
Histogram - Example
1
Histogram - Example
2

Ridgeline - Example
1
## Picking joint bandwidth of 458

Ridgeline - Example
2

Boxplot - Example
1

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

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
