Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why permutedims? #118

Open
lmiq opened this issue Nov 9, 2023 · 0 comments
Open

why permutedims? #118

lmiq opened this issue Nov 9, 2023 · 0 comments

Comments

@lmiq
Copy link

lmiq commented Nov 9, 2023

"Kernel density at corresponding gridpoints `Tuple.(x, permutedims(y))`."

Why do we carry this permutedims? This requires that StatsPlots explicitly perform the inverse transformation to plot a kde correctly, and it makes Plots default functions to plot the kde incorrectly with the most simple interpretation of the result:

julia> using Plots, KernelDensity

julia> x =  vcat(randn(1000), 10 .+ randn(1000));

julia> y = randn(2000);

julia> d = kde((x,y));

julia> heatmap(d.x, d.y, d.density)

julia> scatter!(Tuple.(zip(x,y))

produces:

image

for the records,

julia> heatmap(d.x, d.y, permutedims(d.density))

will produce the correct plot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant