Created
November 24, 2013 01:44
-
-
Save jglenes/7622349 to your computer and use it in GitHub Desktop.
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
# Change the number of digits displayed on ggplot axes | |
# Define a number formatting function | |
fmt <- function(ndec) { | |
function(x) format(x,nsmall=ndec) | |
} | |
ggplot(mpg, aes(x=mpg$displ,y=mpg$hwy)) + | |
geom_point() + | |
scale_x_continuous(labels=fmt(2)) + | |
scale_y_continuous(labels=fmt(3)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment