2

Using library(tidyverse), fix this code by making the point blue instead of red:

ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy, colour = "blue"))

Not sure where where to input the code to change it to blue instead of red, can anyone explain why it is default red and what the code would look like to change the colour?

zx8754
  • 52,746
  • 12
  • 114
  • 209
cchen
  • 29
  • 3
  • The `colour` argument should be out of the `mapping` argument : `ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy), colour = "blue")` – Basti Sep 30 '21 at 15:12
  • Found out how to change the initial code into blue points but how to I keep the legend in? Currently looks like: 1. ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy), color = "blue") – cchen Sep 30 '21 at 15:13
  • @Basti how would you keep the legend visible with that? – cchen Sep 30 '21 at 15:15
  • 1
    This page may help give you some of the answers you are looking for: https://stackoverflow.com/questions/55301575/r-ggplot-geom-point-change-color – Silentdevildoll Sep 30 '21 at 15:56

0 Answers0