pythonmatplotlibscatter3d

Matplotlib alternative for 3D scatter plots


I am having a hard time using Matplotlib to visualize reprojection results of my data in 3 dimensions after applying Principle components analysis or Linear discriminant analysis. After doing a scatter plot, I cannot rotate the data or change the point of view while zooming easily (Rotation axis stays the same even after you zoom, and if you zoom too much points just disappear) and every change takes one second to occur. Matplotlib is very useful but for this specific use case it starts to get very frustrating as it probably wasn't designed for such tasks. Is there an alternative to Matplotlib in Python that can handle 3d scatter plots better and where one could fluidly navigate through the cloud?

An example is shown in the next figure. I have drawn spheres around each data cluster corresponding to a specific class and colored overlapping spheres with red. Now I want to see how these sphere intersect. I think the biggest problem with Matplotlib is that it doesn't allow shifting of the whole graph with the mouse, it only allows rotation around a fixed point, which makes things very messy once you zoom a bit.

enter image description here


Solution

  • matplotlib is not quite mature for 3d graphics : http://matplotlib.org/mpl_toolkits/mplot3d/faq.html

    mplot3d was intended to allow users to create simple 3D graphs with the same “look-and-feel” as matplotlib’s 2D plots. Furthermore, users can use the same toolkit that they are already familiar with to generate both their 2D and 3D plots.

    I don't think easy navigation in a 3d plot is easily doable (even 3d scaling is not possible without tweaking the lib). mplot3d was not really intended to be a full-fledged 3D graphics library in the beginning, but more a nice addition for people who needed basic 3D and who were acquainted with matplotlib 2D plot structure.

    You might want to take a look at MayaVI (which is pretty good) :

    MayaVi2 is a very powerful and featureful 3D graphing library. For advanced 3D scenes and excellent rendering capabilities, it is highly recomended to use MayaVi2.