Is there something like a depth buffer in matplotlib?

I am trying to build some curves with matplotlib.
But, since these curves overlap with each other from the viewport. So there cannot be only z-order.

I wonder if the function works as a depth buffer in matplotlib.
I draw something like this. And the red line does not always have to be on top in three-dimensional space.

+7
source share
2 answers

It's hard for me to do such things in matplotlib, as it is a 2D graphics library with some 3D plot ability. I recommend some real 3D graphics libraries like visvis, mayavi, vpython. For example, in visvis you can create a 3D curve, for example:

enter image description here

import numpy as np import visvis as vv app = vv.use() f = vv.clf() a = vv.cla() angle = np.linspace(0, 6*np.pi, 1000) x = np.sin(angle) y = np.cos(angle) z = angle / 6.0 vv.plot(x, y, z, lw=10) angle += np.pi*2/3.0 x = np.sin(angle) y = np.cos(angle) z = angle / 6.0 - 0.5 vv.plot(x, y, z, lc ="r", lw=10) app.Run() 

MayaVi:

enter image description here

 import numpy as np from mayavi import mlab angle = np.linspace(0, 6*np.pi, 1000) x = np.sin(angle) y = np.cos(angle) z = angle / 6.0 mlab.plot3d(x, y, z, color=(1,0,0), tube_radius=0.1) angle += np.pi*2/3.0 x = np.sin(angle) y = np.cos(angle) z = angle / 6.0 - 0.5 mlab.plot3d(x, y, z, color=(0,0,1), tube_radius=0.1) mlab.axes() mlab.show() 
+13
source

You can try to use the fill_between function to color the areas manually. See an example of random walkers:

http://matplotlib.sourceforge.net/users/recipes.html

http://matplotlib.sourceforge.net/users/recipes-6.py

+1
source

All Articles