Skip to content
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

Use autolim kwarg in add_collection to prevent duplication of effort. #3100

Merged
merged 1 commit into from Jun 2, 2014

Conversation

efiring
Copy link
Member

@efiring efiring commented Jun 1, 2014

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 by 88b722f.

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 matplotlib#3095, which reported a regression that appears to have been
introduced by 88b722f.
@@ -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
Copy link
Member

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?

Copy link
Member Author

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 by cla(); subsequently, anything that updates the dataLim needs to set it to False so that the updating is cumulative rather than starting again from scratch.

@tacaswell tacaswell added this to the v1.4.0 milestone Jun 1, 2014
tacaswell added a commit that referenced this pull request Jun 2, 2014
Use autolim kwarg in add_collection to prevent duplication of effort.
@tacaswell tacaswell merged commit 62bae67 into matplotlib:master Jun 2, 2014
@@ -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)
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Memory issue when plotting large arrays with pcolormesh
4 participants