implementing `ggplot2` when layering multiple geoms with differing aesthetics in R 4.3
I'm collaborating on a project where I just started working with I'm trying to create a combined scatter and line plot using `ggplot2` in R 4.3, but I'm running into an scenario when adding different aesthetics for each layer. I have a data frame containing two numeric columns, `x` and `y1`, for the scatter plot, and another numeric column `y2` for the line plot. My goal is to display the scatter points in blue and the line in red, but when I attempt to layer them, the colors seem to revert to default settings. Here's the code I've been using: ```r library(ggplot2) # Sample data set.seed(123) df <- data.frame(x = 1:10, y1 = rnorm(10), y2 = rnorm(10)) # Creating the plot p <- ggplot(df, aes(x = x)) + geom_point(aes(y = y1), color = 'blue') + geom_line(aes(y = y2), color = 'red') print(p) ``` When I run the code, the points are plotted correctly in blue, but the line appears in the default color (which seems to be black). I've also tried using `scale_color_manual()` to define the colors explicitly, but it doesn't seem to affect the line's color. I've checked that I don't have any global theme settings that could be overriding my layer specifications. Am I missing something with the aesthetics for the `geom_line`? Any insights would be appreciated! For context: I'm using R on macOS. I recently upgraded to R 3.9. Has anyone else encountered this?