Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Use autolim kwarg in add_collection to prevent duplication of effort.#3100
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This changeset cleans up several problems associated with updatingAxes.dataLim. The basic point is that when a method that createsa collection also updates Axes.dataLim, Axes.add_collection() should becalled with autolim=False. With autolim=True, add_collection willuse a very general method to update the dataLim, but in many casesthe method creating the collection can perform the update much moreefficiently.Closesmatplotlib#3095, which reported a regression that appears to have beenintroduced by88b722f.
@@ -4301,9 +4301,10 @@ def get_interp_point(ind): | |||
XY2 = np.array([x[where], y2[where]]).T | |||
self.dataLim.update_from_data_xy(XY1, self.ignore_existing_data_limits, | |||
updatex=True, updatey=True) | |||
self.ignore_existing_data_limits = False |
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.
Why did this get added?
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.
This flag is initialized to True bycla()
; subsequently, anything that updates the dataLim needs to set it to False so that the updating is cumulative rather than starting again from scratch.
Use autolim kwarg in add_collection to prevent duplication of effort.
@@ -5032,7 +5033,7 @@ def pcolormesh(self, *args, **kwargs): | |||
corners = (minx, miny), (maxx, maxy) | |||
self.update_datalim(corners) | |||
self.autoscale_view() | |||
self.add_collection(collection) | |||
self.add_collection(collection, autolim=False) |
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 think the better solution (but not the quicker solution, so I'm happy this PR was merged) would be to implement an appropriate data limit updater on the QuadMeshCollection - I'm not sure I'll get around to doing this anytime soon, so just wanted to post it here as a reminder.
This changeset cleans up several problems associated with updating
Axes.dataLim. The basic point is that when a method that creates
a collection also updates Axes.dataLim, Axes.add_collection() should be
called with autolim=False. With autolim=True, add_collection will
use a very general method to update the dataLim, but in many cases
the method creating the collection can perform the update much more
efficiently.
Closes#3095, which reported a regression that appears to have been
introduced by88b722f.