rainbowthug
rainbowthug

Reputation: 77

Ggplot is not able to be run by R?

I am training on diamonds set, I don't thing it is impossible to be runned by R

ggplot(data = diamonds, mapping = aes(x = carat, y = price)) +
  geom_point()+
  geom_smooth(data = diamonds[diamonds$carat<3.1], method = 'lm', color ='red')

any suggestions? Thank you in advance

Upvotes: 1

Views: 37

Answers (1)

Duck
Duck

Reputation: 39595

Try this:

#Code
ggplot(data = diamonds, mapping = aes(x = carat, y = price)) +
  geom_point()+
  geom_smooth(data = diamonds[diamonds$carat<3.1,], method = 'lm', color ='red')

Output:

enter image description here

Upvotes: 3

Related Questions