I’m analyzing some data that follows a more-or-less-linear dependency. Here’s a picture:
I’d like to show the dispersion around the mean for each of the vertical bins you see. What I need is (I think) the density() function, so to have a nice plot of the dispersion. However, density() returns a plot, not data. I need to combine all these plots toghether, possibly in 3 dimensions. How can I do that?
For reference, I’m thinking about something like these (pictures found on the web and with no connection):
julia> using Plots, KernelDensity
julia> data = [ randn(1000) for _ in 1:10 ]; # data for each coordinate
julia> densities = [ kde(dat).density for dat in data ]; # densities
julia> density_matrix = hcat(densities...); # turn all into a matrix
julia> surface(density_matrix) # create surface