Hello I have a smooth scatter plot same plot I wanted try with ggplot with, can anyone help me i have created plot using ggplot but not able create curve line and diagonal line same as smooth scatter plot
data
A B cat
0.8803 0.0342 data1
0.9174 0.0331 data1
0.9083 0.05 data1
0.7542 0.161 data2
0.8983 0.0593 data2
0.8182 0.1074 data2
0.3525 0.3525 data3
0.5339 0.2288 data3
0.7295 0.082 data3
smooth scatter plot
df=read.table("test.txt", sep='\t', header=TRUE)
smoothScatter(df$B,df$A,,nrpoints=Inf,xlim=c(0,1),ylim=c(0,1), pch=20,cex=1, col=df$cat)
points(c(0,1),c(1,0),type='l',col='green',lty=2,lwd=2)
p=0:1000/1000
points((1-p)^2,p^2,type='l',col='red',lty=2,lwd=2)
ggplot script
ggplot(df, aes(x=B, y=A))+
geom_point()