Reputation: 5049
How do I remove the points from a scatter plot created by below code ? I just wanted to keep the smoothed line.
ggplot(mtcars, aes(x=wt, y=mpg, color=cyl, shape=cyl)) +
geom_point() +
geom_smooth(method=lm)
Upvotes: 0
Views: 5119
Reputation: 15072
Take out geom_point
, it's what's generating the points.
library(ggplot2)
ggplot(mtcars, aes(x = wt, y = mpg, color = cyl)) +
geom_smooth(method = lm)
Created on 2018-04-26 by the reprex package (v0.2.0).
Upvotes: 4