normal distribution – How can I plot multiple lines in ggplot2 in R?

How can I do this plot in ggplot2 form?

transform this image to ggplot2 in R

its code is

mydata<-data.frame(alph=c(rep(c(0.01,0.05,0.1),each=6)),case=c(rep(c("R","N","R","N","R","N"),each=3) ),
                   Tests=c(rep(c("SW","AD","LF","SW","AD","LF","SW","AD","LF"),each=1) ) ,
                   means=c(0.461,0.504,0.460,0.816,0.796,0.794,   0.619,0.650,0.602,0.630,0.602,0.620,   0.689,0.721,0.690,0.512,0.481,0.511))
                   

x<-c(1,2,3)
y1<-mydata[4][mydata[2]=="R" & mydata[3]=="AD",]
plot(x, y1, type = "l", xaxt = "n",ylim=c(0,1), xlab = "Alpha", ylab = "Means")
axis(1, labels = as.character(c(0.01,0.05,0.1)), at = x)

y2<-mydata[4][mydata[2]=="R" & mydata[3]=="SW",]
y3<-mydata[4][mydata[2]=="R" & mydata[3]=="LF",]
lines(x, y2, type = "l", col=2)
lines(x, y3, type = "l", col=3)

y4<-mydata[4][mydata[2]=="N" & mydata[3]=="AD",]
y5<-mydata[4][mydata[2]=="N" & mydata[3]=="SW",]
y6<-mydata[4][mydata[2]=="N" & mydata[3]=="LF",]
lines(x, y4, type = "l", lty=2)
lines(x, y5, type = "l", lty=2, col=2)
lines(x, y6, type = "l", lty=2, col=3)

I try to plot one line by use this code in ggplot2 but there is wrong I couldn’t deal with it

ggplot(mydata, aes(x=c(1,2,3))) + 
  geom_line(aes(y = mydata[4][mydata[2]=="N" & mydata[3]=="AD",]), color = "darkred") 

Read more here: Source link