2 つの密度プロットを重ね合わせたヒストグラムを作成しようとしています。問題: 1 つの密度を破線にしたいのですが、これは完全に機能しますが、次の例のように、凡例では破線が表示されません。
x<-sort(rnorm(1000))
data<-data.frame(x=x,Normal=dnorm(x,mean(x),sd=sd(x)),Student=dt(x,df=3))
ggplot(data,aes(y=x))+geom_histogram(aes(x=x,y=..density..),
color="black",fill="darkgrey")+geom_line(aes(x=x,y=Normal,color="Normal"),size=1,
linetype=2)+ylab("")+xlab("")+labs(title="Density estimations")+geom_line(aes(x=x,y=Student,color="Student"),size=1)+
scale_color_manual(values=c("Student"="black","Normal"="black"))
凡例で破線を取得する方法はありますか?
どうもありがとうございました!
ライナー