Skip to content

Instantly share code, notes, and snippets.

@dwhdai
Created May 17, 2019 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dwhdai/72f957e5d95db92fa94f4f6fc6d015c1 to your computer and use it in GitHub Desktop.
Save dwhdai/72f957e5d95db92fa94f4f6fc6d015c1 to your computer and use it in GitHub Desktop.
ggplot2 quick axis labels using scales
plot <- ggplot(...)
# Log 10 transformation
plot +
scale_x_continuous(trans = "log10",
breaks = scales::trans_breaks("log10", function(x)10^x),
labels = scales::trans_format("log10", scales::math_format(10^.x)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment