Problem I have a dataset consiting of 3D coordinates (x,y,z) and I want to visualize the hull of each cluster separately, conserving complex spatial structures of the data, such as in the following examples:
What I have tried:
- matplotlib's convex hull: This does not seem to be able to conserve the spatial structure such as "holes" or rings, but instead builds a convex hull around all given data points
- mayavi's mlab: This seems to work well for continuous functions, such as np.sin(x)*np.cos(x)*np.sin(z) for example, but not for datasets of discrete points as in my case.
An example, based on the answers to How to plot a 3D density map in python with matplotlib and 3D Contour plot from data using Mayavi / Python, is to use a Gaussian KDE and generate a 3D contour plot of the output using mayavi:
This produces:
I'm sure a lot could be done within mayavi to prettify this.