Skip to content

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

MengAiDev
Copy link

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

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
@QuLogic
Copy link
Member

QuLogic commented Aug 19, 2025

Please fix the linting errors.

@MengAiDev
Copy link
Author

Please fix the linting errors.

I fix it.

@QuLogic
Copy link
Member

QuLogic commented Aug 19, 2025

This looks good, but should probably get a test so it doesn't break again.

@MengAiDev
Copy link
Author

@QuLogic I have add the test.

Copy link
Member

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
Copy link
Member

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.

Suggested change
# This should not raise an exception with the fix
# This should not raise an exception.

Comment on lines +2714 to +2715

plt.close(fig)
Copy link
Member

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.

Suggested change
plt.close(fig)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for author
Development

Successfully merging this pull request may close these issues.

[Bug]: error using add_collection3d of Line3DCollection with autolims=True and lines containing different numbers of points
2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy