Closed as not planned
Closed as not planned
Description
Bug summary
A little tricky to explain, but see the outcomes below. Found while making tests for #28225
Code for reproduction
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
theta = np.linspace(0, 2*np.pi, 50)
x1 = x2 = x3 = np.cos(theta)
y1 = y2 = y3 = np.sin(theta)
z1 = np.ones_like(theta) * 0
z2 = np.ones_like(theta) * 1
z3 = np.ones_like(theta) * 2
# flip direction of this face
x3 = x3[::-1]
y3 = y3[::-1]
verts = list(zip(x1, y1, z1)) + list(zip(x2, y2, z2)) + list(zip(x3, y3, z3))
verts = np.array([verts])
poly = Poly3DCollection(verts, alpha=.7, edgecolor='k')
fig = plt.figure()
ax = fig.add_subplot(projection='3d')
ax.add_collection3d(poly)
ax.auto_scale_xyz(verts[:, :, 0], verts[:, :, 1], verts[:, :, 2])
ax.set_aspect('equalxy')
plt.show()
Actual outcome
From this view, everything looks as expected
From this view, the overlapping area of the top and middle faces cancel out and show full transparency (bug).
From this view, the above is still happening, but the bottom face still shows properly even though it's in the intersection area.
The semi-transparent areas should really stack to a more opaque coloring as well, but that's a separate issue.
Expected outcome
If you don't reverse x3
and y3
, the result looks as expected:
Additional information
No response
Operating system
No response
Matplotlib Version
latest main
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
git checkout