ggplot(data = Covid_data_filtered, mapping = aes(x = Pneumonia.Deaths, y = Covid_Deaths))+geom_point()
Asked
Active
Viewed 34 times
0

Phil
- 7,287
- 3
- 36
- 66

CM_Garrott
- 1
- 1
-
2Change `aes(x = Pneumonia.Deaths, y = Covid_Deaths)` to `aes(x = as.numeric(Pneumonia.Deaths), y = Covid_Deaths)` – Phil Mar 31 '21 at 20:26
-
To expand a bit on Phil's comment, because `Pneumonia.Deaths` is a character or factor variable, ggplot2 is giving you a discrete x-axis. If it is a factor instead of a character, you should use `as.numeric(as.character(Pneumonia.Deaths))`. – teunbrand Mar 31 '21 at 21:10
-
I tried both of them & this is what i got & now a chart isn't popping up at all. ggplot(data = Covid_data_filtered, mapping = aes(x = as.numeric(as.character(Pneumonia.Deaths)), y = Covid_Deaths))+geom_point() Error in FUN(X[[i]], ...) : object 'Covid_Deaths' not found In addition: Warning message: In FUN(X[[i]], ...) : NAs introduced by coercion > ggplot(data = Covid_data_filtered, mapping = aes(x = as.numeric(Pneumonia_Deaths)), y = Covid_Deaths)+geom_point() Error: geom_point requires the following missing aesthetics: y Run `rlang::last_error()` to see where the error occurred. – CM_Garrott Mar 31 '21 at 22:15