0

Hello I have the following question about ggplot and geom_smooth. How do I get it so that the individual lines are less visible, so adjust the alpha so to speak. Unfortunately alpha here only changes the visibility of the CIs. How can I still adjust it?

This is my code:

ggplot() +
  stat_smooth(se=F, data = df_pat, aes(x = sc, y = changes, color = factor(pat), group = factor(pat)), alpha = 0.0001) +
  geom_smooth(se=F, data = new_df, aes(x = sc, y = changes, color = factor(pat), group = factor(pat))) +
  labs(x = expression(" " ~ epsilon),
       y = "y") +
  scale_color_viridis(discrete = TRUE, option = "D")+
  scale_fill_viridis(discrete = TRUE) +
  guides(color = guide_legend(title = "Pattern"))+
  theme(legend.position = "bottom")

My plot: enter image description here

Did my research on the web

stefan
  • 90,330
  • 6
  • 25
  • 51
  • Actually `alpha` will only affect the ribbons in `geom_smooth` but has no effect on the lines, but you can overcome this by using `geom="line"` in stat_smooth. See https://stackoverflow.com/questions/19474552/adjust-transparency-alpha-of-stat-smooth-lines-not-just-transparency-of-confi – stefan Jul 15 '23 at 11:44

0 Answers0