Graph does not change even if the code is right

can anyone please tell me why the graph is not changing even if the code's right? thanks in advance for your availability ! :wink:

I think your issue may be that you are using the "fill" aesthetic rather than "colo(u)r".

If you change every instance of "fill" to "colour" your scatter plot should be coloured by Mileage.

Thank you for your reply! i have just tried to change it but nothing happened, the code is still right but I cannot see the colors in the graph :frowning:


To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

You are assigning your plot to the variable "p" - could it be that you are not printing "p" to your console? A script may look something like this:


p = ggplot(mtcars, aes(x = mpg, y = wt)) +
  geom_point() +

p = p + aes(color = drat) + scale_color_continuous(low = "white", high = "red")


even putting = instead of <- did not change the situation :((

If you are running it in a script then it will not be output. In that case print(p) should work. If you are running the code interactively, then either should work.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.