Last active
February 19, 2020 12:23
-
-
Save namelessjon/164917abf32207dcc22fe7988803133b to your computer and use it in GitHub Desktop.
Exponential scales in ggplot with tidy labels
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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