Reputation:
I am trying to change my confidence bands to the same color as my regression lines but I am currently stuck. Any help would be appreciated!
Upvotes: 1
Views: 951
Reputation: 39595
You can check this code that can be useful. I have used new dataset penguins
. As Dr. Bolker said, be careful about the color
and fill
options in your aes()
. As no data was included I tried to replicate your colors and shading style:
library(tidyverse)
library(palmerpenguins)
#Code for plot
ggplot(penguins, aes(x=bill_length_mm, y=flipper_length_mm,
color=species,fill = species)) +
geom_point() +
geom_smooth(method=lm,alpha=0.2)+
scale_fill_manual(values=c("blue","gold","brown"))+
scale_color_manual(values=c("blue","gold","brown"))
Output:
Upvotes: 3
Reputation: 226232
I think you need aes(fill=as.factor(numbers)))
rather than fill=aes(as.factor(numbers))
Upvotes: 1