Distribution plot 3
Category: distribution
library(tidyverse)
library(gghalves)
library(ggbeeswarm)
library(wesanderson)
# https://github.com/allisonhorst/palmerpenguins
library(palmerpenguins)
p <- ggplot(penguins, aes(species, culmen_length_mm, color = species)) +
geom_beeswarm(priority = 'none', size = 1.5, beeswarmArgs = list(side = -1)) +
geom_half_boxplot(aes(fill = species), side = 'r', color = 'black', outlier.size = 0, outlier.color = NA, width = 0.5, alpha = 0.75) +
scale_color_manual(name = 'Species', values = wes_palette('Darjeeling1', 3, type = 'discrete')) +
scale_fill_manual(values = wes_palette('Darjeeling1', 3, type = 'discrete')) +
scale_y_continuous(labels = scales::comma) +
theme_bw() +
labs(y = 'Culmen length [mm]') +
theme(
legend.position = 'none',
axis.title.x = element_blank(),
panel.grid.major.x = element_blank()
)
ggsave('3.png', p, height = 5, width = 6)