library(tidyverse)
library(palmerpenguins)
avg_flipper <- penguins %>%
group_by(species) %>%
summarize(avg_flipper_length = mean(flipper_length_mm, na.rm = TRUE))
#> `summarise()` ungrouping output (override with `.groups` argument)
# Native horizontal geoms, but legend pointranges are still vertical
ggplot(avg_flipper, aes(x = avg_flipper_length, y = species, color = species)) +
geom_pointrange(aes(xmin = 0, xmax = avg_flipper_length)) +
labs(subtitle = "Native horizontal geoms, but legend pointranges are still vertical")
# ggstance horizontal geoms with horizontal legend pointranges
ggplot(avg_flipper, aes(x = avg_flipper_length, y = species, color = species)) +
ggstance::geom_pointrangeh(aes(xmin = 0, xmax = avg_flipper_length)) +
labs(subtitle = "ggstance horizontal geoms with horizontal legend pointranges")
Created on 2020-09-29 by the reprex package (v0.3.0)