Does the matplotlib
in python 2.x support hidden line removal?
How can I implement it myself?
This is a further question of another post solved here: How to obtain 3D colored surface via Python?
Does the matplotlib
in python 2.x support hidden line removal?
How can I implement it myself?
This is a further question of another post solved here: How to obtain 3D colored surface via Python?
I'm assuming that by "hidden" you mean lines that are behind surface patches in the view, e.g., behind "hills" in the plot.
Use plot_surface
instead of plot_wireframe
:
I used
plot_wireframe(X, Y, Z, rstride=10, cstride=10)
to create the first and
plot_surface(X, Y, Z, rstride=10, cstride=10, color="white", shade=False, edgecolor="blue")
to create the second plot.
If you want to combine this with colormapping the edges, you'll have to use some internals. If you use the cmap
argument to colormap the surface faces, the source code for Poly3DCollection.do_3d_projection
eventually calls to_rgba(self._A)
to calculate face colors. Remap this to edge colors, and you're good to go:
surf = ax.plot_surface(X, Y, Z, rstride=2, cstride=2, shade=False, cmap="jet", linewidth=1)
surf.set_edgecolors(surf.to_rgba(surf._A))
surf.set_facecolors("white")
produces this plot:
(You might have to call set_edgecolors
/set_facecolors
again after the first render pass as do_3d_projection
might override the values; I ran this in interactive mode and have not checked.)