Put linetype=
inside aes()
for each stat_density()
with the same names as for colors=
and then use scale_linetype_manual()
to set types as you need. If you use the same legend name for linetypes and colors, both legend will be put together.
ggplot(data=df)+
stat_density(aes(x=R1, colour="rho = -0,6",linetype="rho = -0,6"),
adjust=4, lwd=0.5, geom="line", position="identity")+
stat_density(aes(x=R2, colour="rho = 0,6",linetype="rho = 0,6"),
adjust=4, lwd=0.5, geom="line", position="identity")+
stat_density(aes(x=R3, colour="rho = 0", linetype="rho = 0"),
adjust=4, lwd=0.5, geom="line", position="identity")+
xlim(-0.5, 0.5)+
xlab("Renditen")+
ylab("Dichte")+
ggtitle("Renditeverteilung im Heston-Modell")+
theme(plot.title=element_text(face="bold", size=16, vjust=2),
axis.title.x=element_text(vjust=-1, size=12),
axis.title.y=element_text(vjust=-0.25, size=12),
legend.text=element_text(size=12), legend.title=element_text(size=12),
legend.margin=unit(1.5, "cm"),
legend.key.height=unit(1.2, "line"),
legend.key.size=unit(0.4, "cm"),
legend.key=element_rect(fill=NA),
legend.background=element_rect(colour="darkgrey"),
plot.margin=unit(c(1,1,1,1), "cm"))+
scale_colour_manual(values=c("rho = -0,6"="red", "rho = 0,6"="blue",
"rho = 0"="black"), name="Korrelation")+
scale_linetype_manual(values=c("rho = -0,6"=1, "rho = 0,6"=1,
"rho = 0"=2), name="Korrelation")