Skip to content

Instantly share code, notes, and snippets.

@namelessjon
Last active February 19, 2020 12:23
Show Gist options
  • Save namelessjon/164917abf32207dcc22fe7988803133b to your computer and use it in GitHub Desktop.
Save namelessjon/164917abf32207dcc22fe7988803133b to your computer and use it in GitHub Desktop.
Exponential scales in ggplot with tidy labels
# Exponential scales in ggplot with tidy labels
p <- ggplot(data, aes(...))
p <- p + scale_x_log10(
breaks = 10^seq(0, 6, by = 2), # generate breaks every 2 powers of 10, starting at 1
minor_breaks = 10^seq(0, 6),
labels = parse(text = c("1", "100", "10^4", "10^6")) # this makes them pretty
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment