Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plotting 3D graphics in Python 3

I want to do some 3D plotting to visualize some data. I'm using matplotlib but the 3D features of matplotlib are not as powerful as 2D plotting. I found Mayavi very powerful. Even matplotlib recommends it in http://matplotlib.org/mpl_toolkits/mplot3d/faq.html

However, most of my previous work are done in Python 3, but MayaVi do not support Python 3 yet.

How could I plot 3D graphics in Python 3?

like image 432
iuradz Avatar asked Jul 15 '15 05:07

iuradz


People also ask

Is 3d graph possible in matplotlib?

Matplotlib was introduced keeping in mind, only two-dimensional plotting. But at the time when the release of 1.0 occurred, the 3d utilities were developed upon the 2d and thus, we have 3d implementation of data available today! The 3d plots are enabled by importing the mplot3d toolkit.


1 Answers

Vispy is a relatively new framework under active development, which has recently grown powerful and flexible enough (in its high level interfaces) to replace my own use of mayavi. The downside is that it's a little more involved for some things right now, as this high level stuff is still being developed. Having observed its progress for a while I'm confident that the remaining issues will be fairly quickly addressed, and I think it will end up with a robust interface similar to mayavi but with more varied features that are relatively easy to modify at lower levels. This is particularly in comparison to mayavi which has many powerful features of its own, but which I found relatively difficult to work with once away from the main, well documented interfaces.

I've also heard good things about glumpy and PyQtGraph, but I haven't tried these. Glumpy's documentation seems relatively sparse and focus on relatively low level operations compared to mayavi, but its examples exhibit a wide range of powerful effects. PyQTGraph has a more sophisticated UI (maybe more familiar if you like mayavi's ui stuff, though it's not the same) and maybe some different plotting features.

Of course you can also use opengl directly, but this means reinventing a lot of wheels. If inclined to go this way, I think vispy (or maybe glumpy) is still a good choice, as its low level opengl wrappers are nice but you can potentially take advantage of its higher level stuff.

like image 139
inclement Avatar answered Oct 19 '22 03:10

inclement