描画の上下関係がおかしいとき
必ずしも空間上の上下関係を反映してくれない!
zorderが高いものほど上にプロットされる
Zorder Demo — Matplotlib 3.9.0 documentation
default Zorder
Images: 0
AxesImage, FigureImage, BboxImage
patch: 1
Patch, PatchCollection
Line2D, LineCollection: 2
including minor ticks, grid lines
Major Ticks: 2.01
Poly3DCollection: 2.5
surface (plot_surface()) など
Text: 3
Legend: 5
Axis3Dを使ったプロットでは、これまで描画順序を変更できなかった?が、v3.5.0で追加された
from python - 3D parametric curve in Matplotlib does not respect zorder. Workaround? - Stack Overflow
computed_zorder=Falseを指定すると手動でzorderを指定できる
code:py
ax = plt.axes(projection='3d', computed_zorder=False)
ax.plot_surface(X1, Y1, Z1,zorder=4.4)
ax.plot_surface(X2, Y2, Z2,zorder=4.5)
blitも関係あるかも
FuncAnimation
blit : bool, default: False
Whether blitting is used to optimize drawing. Note: when using
blitting, any animated artists will be drawn according to their zorder;
however, they will be drawn on top of any previous artists, regardless
of their zorder.