Hi, In the code (in sec. 12.4.5 - zooming), you have used:
Left
ggplot(mpg, aes(x = displ, y = hwy)) +
geom_point(aes(color = drv)) +
geom_smooth() +
scale_x_continuous(limits = c(5, 6)) + # drv is a categorical #var
scale_y_continuous(limits = c(10, 25))
Whereas, if I use the scale_x_discrete, the plot is significantly different, why? I am a novice, hence thought I ask. Which plot is accurate?
ggplot(mpg, aes(x = displ, y = hwy)) +
geom_point(aes(color = drv)) +
geom_smooth() +
scale_x_discrete(limits = c(5, 6)) +
scale_y_continuous(limits = c(10, 25))
Hi, In the code (in sec. 12.4.5 - zooming), you have used:
Left
ggplot(mpg, aes(x = displ, y = hwy)) + geom_point(aes(color = drv)) + geom_smooth() + scale_x_continuous(limits = c(5, 6)) + # drv is a categorical #var scale_y_continuous(limits = c(10, 25)) Whereas, if I use the scale_x_discrete, the plot is significantly different, why? I am a novice, hence thought I ask. Which plot is accurate? ggplot(mpg, aes(x = displ, y = hwy)) + geom_point(aes(color = drv)) + geom_smooth() + scale_x_discrete(limits = c(5, 6)) + scale_y_continuous(limits = c(10, 25))