How to change color of line and confidence interval in ggplot?

28 Views Asked by At

I am working on plotting linear mixed effects results and would like to make some adjustments in how it is presented. Here is the current code for the plot.

lme_plotp %>%
  ggplot(aes(x = x, y = predicted, group = interaction(base_age, group), color = group)) +
  geom_ribbon(aes(ymin = conf.low, ymax = conf.high, fill = group), alpha = 0.5) +
  geom_line() +
  scale_color_manual(values=c('#D55E00', '#0072B2')) +
  scale_fill_discrete(name = "Biomarker status", labels = c("Lower", "Higher")) +
  labs(
    title = "LME of Outcome and Biomarker",
    x = "Age (yrs)",
    y = "Outcome",
    caption = "LME model plot"
  ) +
  theme_classic()

enter image description here

I was hoping to change the blue line and confidence interval red and the red line and confidence interval blue. Also, I was wondering how to reverse the labels of the legend so that the higher line and color would appear first rather than second.

0

There are 0 best solutions below