-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: AttributeError: 'Path3DCollection' object has no attribute '_offset_zordered' (possible regression) #26497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Bisect points to 94e21bd. |
Is this open for contribution? |
@agnes-sharan anyone is welcome to work on any issue. Please see our Contributors’ Guide. |
Hi, import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d.art3d import Line3DCollection
import numpy as np
lc = [
(
np.fromiter([0.0, 0.0, 0.0], dtype="float"),
np.fromiter([1.0, 1.0, 1.0], dtype="float"),
)
]
pc = [
np.fromiter([0.0, 0.0], dtype="float"),
np.fromiter([0.0, 1.0], dtype="float"),
np.fromiter([1.0, 1.0], dtype="float"),
]
fig = plt.figure()
ax = fig.add_subplot(projection="3d")
lines = ax.add_collection(Line3DCollection(lc))
scatter = ax.scatter(*pc, visible=False)
plt.show() It seems that it is plotting an invisible element that cause an issue. However, if the scatter plot is plotted as visible, and then set invisible and the plot draw again, the error doesn't happen: import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d.art3d import Line3DCollection
import numpy as np
lc = [
(
np.fromiter([0.0, 0.0, 0.0], dtype="float"),
np.fromiter([1.0, 1.0, 1.0], dtype="float"),
)
]
pc = [
np.fromiter([0.0, 0.0], dtype="float"),
np.fromiter([0.0, 1.0], dtype="float"),
np.fromiter([1.0, 1.0], dtype="float"),
]
fig = plt.figure()
ax = fig.add_subplot(projection="3d")
lines = ax.add_collection(Line3DCollection(lc))
sc = ax.scatter(*pc)
plt.draw()
plt.pause(0.001)
sc.set_visible(False)
plt.draw()
input("Press [enter] to continue.") I don't know how to fix this, but I hope that can help. I am using matplotlib 3.7.2 |
Thanks @half1red If nothing else, by bumping this I saw it and was able to fix the bug (and used your example as a test, it also fixes the original issue). |
That's great, happy to hear that, and to help, even so modestly. |
Bug summary
Adding a Line3DCollection to an animation results in Attribute error.
Code for reproduction
Actual outcome
Expected outcome
working animation
Additional information
Affected version: 3.7.2 (macos + homebrew + pip)
Unaffected: 3.6.3 (debian)
I am not sure if it is a backend or version issue. The problem also happens on mac with jupyter notebook and the notebook (inline and widget not tested) backend with my original (non-minimal) code.
Operating system
macos
Matplotlib Version
3.7.2
Matplotlib Backend
MacOSX
Python version
3.11.4
Jupyter version
7.0.2
Installation
pip
The text was updated successfully, but these errors were encountered: