Python - get coordinates of densest point
I am using numpy and scipy to generate a density plot from 3D coordinate information. I can generate a data density plot successfully by building KDE with the following code
xyz = np.vstack([x,y,z]) kde = stats.gaussian_kde(xyz) density = kde(xyz)
But how can I use this information to find the coordinates that are associated with the densest 3D point?
which returns a value which then I can find the index with
but then I hit a space as I cannot use that index to grab related coordinates from xyz and I am not sure if this is the correct approach.
source to share