Since Matplotlib 3.5.0 there is a setting for axis3d which solves this problem. This setting is called computed_zorder.
Example:
ax = plt.axes(projection='3d',computed_zorder=False)
ax.plot_surface(X, Y, Z,zorder=1)
ax.plot_surface(U, V, W,zorder=2)
The element with the highest zorder will be displayed on top.
Some of the default zorder values are listed here:
Artist | zorder |
---|---|
Images (AxesImage, FigureImage, BboxImage) | 0 |
Patch, PatchCollection | 1 |
Line2D, LineCollection (including minor ticks, grid lines) | 2 |
Major ticks | 2.01 |
Text (including axes labels and titles) | 3 |
Legend | 5 |