I have some scatter plots look like this:
The X values are discrete. For every X there's some Y values. I want to plot the density distribution of Y for each X. Like this:
Sorry that I don't know how to describe it, so I draw it by hand. Each red line is a density curve of Y corresponding to an X value. The blue line is the trend line.
In my limited experience with R and ggplot2, I don't have any ideas how to do it. I am searching for a long time on Google but no use. Please help or try to give some ideas how to achieve this. Thanks a lot!