When creating 3D scatter plots with matplotlib I noticed that when the alpha (transparency) of the points is varied it will draw them differently depending on how you rotate the view. The example images below are the same plot rotated slightly, which causes the alpha values to mysteriously reverse. Is anyone familiar with this behavior and how to address it? It looks like the 'zorder' (draw order) is a single value for the entire scatter plot call.
Simplified example code to recreate:
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(projection="3d")
X = [i for i in range(10)]
Y = [i for i in range(10)]
Z = [i for i in range(10)]
S = [(i+1)*400 for i in range(10)]
A = [i/10 for i in range(10)]
ax.scatter(xs=X, ys=Y, zs=Z, s=S, alpha=A)
plt.show()
UPDATE: a fix has been added to matplotlib as part of the future 3.11.0 release (not yet released at time of writing)
I also posted this on the matplotlib github to see what the developers think.
It appears to be a bug with a very low priority, per their latest response: "We have limited core developer resources and mpl_toolkits/mplot3d is only a secondary priority for the core team. Likely this needs someone in the community to pick up and provide a fix."
I will try to do so, but am posting this for visibility in the meantime so that other people with more experience are made aware.