matplotlib/matplotlib — pull request #3347 by KevKeating (2014-08-06 20:36:16+00:00)
Title: Toolbar tracks views if axes are added during use

This is an initial implementation of a fix for #2511. This pull request should **not** be merged. Once MEP22 is merged, I'll port this code to backend_tools.ViewsPositionsMixin. (The porting should be fairly trivial.) I finished the implemented of this recently for in-house use, so I figured I'd put up a PR against master in case anyone had any initial comments.

With this PR, the back, forward, and home buttons in the toolbar will continue to work even if the number of axes changes. I've added a _home_views dictionary that stores the initial views of all axes. If an axes object didn't exist when a view was created, the initial view will be used for that axes. Positions will only be restored if there is a position for all axes objects. This avoids having newer axes overlap with older ones when clicking on back or home.

I haven't disconnected toolbar.update() as an axobserver in this PR since that will be hooked up slightly differently once MEP22 is merged.