How to modify the lines and names of a legend ?

Hello all,
I am making a graph in ggplot2 (geom_line) with two lines and both show up within the legend. However, I am also making a change linetype (scale_linetype_manual(values=c("solid", "twodash"))) and a change the names of a legend (scale_color_discrete(labels =expression(widehat(gamma)[list(1,k)]^(H), widehat(gamma)[list(1,k)]^(CDM)))), however, I have got two legends. Is there a way to remove the first legend (Hillــــــــ , CDM------) and change linetype the second legend?

df1 <- data.frame(k, y=estimatorHill, Legende="Hill")
df2 <- data.frame(k, y=estimatorCDM, Legende="CDM")
dfF<- rbind(df1, df2)

library(ggplot2)
estimators <- ggplot(dfF, aes(k, y, colour=Legende, linetype=Legende)) + 
  geom_line(aes())+
  labs(x = "k", y="Estimators" )+
  ylim(c(0, 1.1))+ 
  geom_hline(yintercept=Gamma1)+
  scale_color_discrete(labels = expression(widehat(gamma)[list(1,k)]^(H),
                                           widehat(gamma)[list(1,k)]^(CDM)))+
  #scale_linetype_manual(values=c("solid", "twodash"))+
  theme( legend.title = element_blank())
estimators

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.