Fix plot_wireframe
with nonequal rstride
, cstride
, plus additional speedups
#29435
+19
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR summary
I accidentally introduced a regression in #29399, which broke wireframe plots when there are an unequal number of rows and columns. That case forms ragged data which can not be concatenated into a single numpy array. This fixes that, and adds an image test. But the fix isn't ideal, and there are a few different paths we could take:
Note that this issue isn't present for other collections such as Poly3DCollection because those do not plot a higher density of data on the lines in-between grid points like Line3DCollection does.
There is also a performance improvement here. In the previous PR I identified the autoscaling of the axes as a large time sink, but didn't realize that there was lower hanging fruit. Instead of autoscaling based on all the X, Y, Z data passed in, we now only autoscale based on the visible data. For my example test of a 4000x4000 wireframe at the default rstride, cstride = 50, this reduces the data parsed for autoscaling from 3x4000x4000 to 3x4000x100. There is a slight change in behavior in that axis limits will no longer bound data which are skipped over between lines, which changes one of the baseline image tests.
Before, majority of plot time (3.5 seconds) dedicated to autoscaling:

After, 20 milliseconds dedicated to autoscaling:

PR checklist