1

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!

  • 2
    A reproducible example would be good: https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – william3031 Sep 24 '20 at 23:40

2 Answers2

3

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:

enter image description here

Duck
  • 39,058
  • 13
  • 42
  • 84
1

I think you need aes(fill=as.factor(numbers))) rather than fill=aes(as.factor(numbers))

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453