r - Using aesthetics with multiple layers in ggplot -
i new ggplot. trying understand how use ggplot. reading wickham's book , still trying wrap head around how use aes()
function.
what's difference between these 2 implementations of aes()
:
library(ggplot2) ggplot(mpg, aes(displ, hwy, colour = class)) + geom_point() + geom_smooth(method = "lm", se = false) + theme(legend.position = "none")
and
ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = class)) + geom_smooth(method = "lm", se = false) + theme(legend.position = "none")
both of them print different graphs. help? stuck.
in first 1 mapping aesthetics globally, ggplot
try map these aesthetics other geom_xyz() layers.
while in latter case, mapping aesethics specific ggplot
layer (in case geom_point()
)
Comments
Post a Comment