Matplotlib 3D limitations, please recommend alternative

William Ray Wing wrw at mac.com
Wed Jul 4 21:37:59 EDT 2018


> On Jul 4, 2018, at 5:53 PM, John Ladasky <john_ladasky at sbcglobal.net> wrote:
> 
> I'm a regular Matplotlib user.  Normally, I graph functions.  I just attempted to graph an icosahedral surface using the plot_trisurf() methods of Matplotlib's Axes3D. I have discovered that Matplotlib is basically hard-wired for graphing functions, and therefore will not work for general-purpose 3D rendering.
> 
> If I have repeated X and Y values in my arrays, it doesn't matter that the Z values might be different.  Matplotlib raises a ValueError, with the message "x and y arrays must consist of at least 3 unique points."  If I break down my polyhedron into individual triangles, I can get 16 of the 20 faces to render, but not all of them.  Here's some minimal example code, which also catches and prints the cause of the ValueError.
> 
> 

[big byte]


> # ============================================================================
> 
> I explored Python OpenGL bindings about three years ago, and quickly got bogged down.  Even with Python to assist, dealing with OpenGL was like trying to program Java.  Of course, OpenGL can do EVERYTHING.  Far more than I need.
> 

The Python Open GL bindings have apparently changed fairly dramatically.  I’m no expert, I’m working my way through the on-line book here:

	http://www.labri.fr/perso/nrougier/python-opengl/

But the author DOES lay things out in a nice step by step fashion - and with particular emphasis on scientific 3D plotting (which is what
I’m after).


> I would like to render polyhedra, preferably with uniformly colored faces (I understand that color is a property that is associated with vertices in OpenGL).  I would appreciate a simple interface.  The rendering doesn't have to be especially fast or high quality.  The Matplotlib visualization is acceptable, except of course for the missing faces.
> 
> There are many 3D graphics packages on PyPI.  Some appear to be quite specialized.  I would appreciate your recommendations.  Thanks!
> -- 
> https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list