-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Fix Line3DCollection with autolim=True for lines of different lengths #30423
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
base: main
Are you sure you want to change the base?
Conversation
When using Line3DCollection with autolim=True, the code was trying to convert ragged arrays (lines with different numbers of points) directly to a numpy array, which would fail. This fix extracts coordinates separately to avoid the issue. Fixes matplotlib#30418
Please fix the linting errors. |
I fix it. |
This looks good, but should probably get a test so it doesn't break again. |
@QuLogic I have add the test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's any need for a new file; this test can go in test_axes3d.py
.
[(1, 0, 1), (2, 1, 2), (3, 2, 3), (4, 3, 4)] # 4 points | ||
] | ||
|
||
# This should not raise an exception with the fix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"with the fix" won't make much sense in a few month.
# This should not raise an exception with the fix | |
# This should not raise an exception. |
|
||
plt.close(fig) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed; all test figures are auto-closed.
plt.close(fig) |
PR summary
When using Line3DCollection with autolim=True, the code was trying to convert ragged arrays (lines with different numbers of points) directly to a numpy array, which would fail. This fix extracts coordinates separately to avoid the issue.
Fixes #30418