ggplot(data = mpg) +
geom_boxplot(mapping = aes(x = trans, y = hwy)) +
coord_flip()
ggplot(data = mpg) +
geom_jitter(mapping = aes(x = cty, y = hwy)) +
geom_abline(color = "red")
The coord_fixed()
calls fixes the aspect ratio, and also the angle of the red line with slope 1:
ggplot(data = mpg) +
geom_jitter(mapping = aes(x = cty, y = hwy)) +
geom_abline(color = "red") +
coord_fixed()
Guessing 40 / 30 from the previous plot:
ggplot(data = mpg) +
geom_jitter(mapping = aes(x = cty, y = hwy)) +
geom_abline(slope = 40 / 30, color = "red") +
coord_fixed()
Copyright © 2018 Kirill Müller. Licensed under CC BY-NC 4.0.