0

Below is my code and I get two legends.

I was wondering

  1. How I can remove one of them? And

  2. Right now, both of them have the numeric values but I want to change the labels of the two points of mod_c in the legend.

I'd appreciate any help.

ggplot(data=data, aes(x=se_c, y=fit, color=mod_c, group=mod_c)) + 
  geom_point() +
  geom_line(aes(linetype=mod_c),size=1.2) +
  geom_ribbon(aes(ymin=lower, ymax=upper, fill=mod_c), alpha=.1) +
  xlab("SE") + xlim(-3,3) +
  ylab("Satisfaction") + ylim(0,3.5) +
  theme_classic()+theme(text=element_text(family="Times New Roman",size=14))+
  scale_fill_manual(values = c("black", "red"), name = "") + 
  scale_color_manual(values = c("black", "red"), name = "") 
Werner Hertzog
  • 2,002
  • 3
  • 24
  • 36
llbia
  • 123
  • 2
  • Please include a photo of your graph so we can understand what you're talking about, and add your data (copy and paste the output from `dput(data)`) so we can run code with – Ricardo Semião e Castro Nov 08 '20 at 14:17
  • Does this answer your question? [Remove extra legends in ggplot2](https://stackoverflow.com/questions/11714951/remove-extra-legends-in-ggplot2) – s__ Nov 08 '20 at 14:18
  • I think you can adapt what is answered here (https://stackoverflow.com/questions/12410908/combine-legends-for-color-and-shape-into-a-single-legend) to your aesthetics – Ricardo Semião e Castro Nov 08 '20 at 14:21

0 Answers0