Last active
August 13, 2022 10:29
-
-
Save juanchiem/b44da13a3d72b308513c01998d72f5a4 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
# the first argument gives expansion equal to its multiplication by limit range; | |
ggplot(mpg, aes(displ, hwy)) + | |
geom_point() + | |
scale_x_continuous(limits = c(1, 7), expand = c(.1, 0)) | |
# right position will be 7 + (7-1) * .1 = 7.6 | |
# the second gives the absolute expansion added to both end of the axis: | |
ggplot(mpg, aes(displ, hwy)) + | |
geom_point() + | |
scale_x_continuous(limits = c(1, 7), expand = c(0, 1)) | |
# right position will be 7 + 1 = 8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment