Skip to content

Instantly share code, notes, and snippets.

@charliejhadley
Last active April 7, 2022 17:58
Show Gist options
  • Save charliejhadley/aa77a543e5775d004b279fdfa765cc41 to your computer and use it in GitHub Desktop.
Save charliejhadley/aa77a543e5775d004b279fdfa765cc41 to your computer and use it in GitHub Desktop.
errors-ggplot2.R
library(tidyverse)
library(palmerpenguins)
penguins %>%
count(island) %>%
mutate(error = 12) %>%
ggplot(aes(x = n,
y = island)) +
geom_col() +
geom_text(aes(label = str_glue("{n} ± {error}")),
color = "white",
fontface = "bold",
hjust = 1.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment