Repository: matplotlib/matplotlib
Pull request: FIX: update spine positions before get extents
## PR Summary

Closes #11737 (supercedes #11739, #11742)  

If you zoomed on an axes, `get_tightbbox` would return a huge bounding box because spine objects didn't have their x/ylims properly set from the axis info yet.  This PR sets those limits when `get_window_extent` is called making the bounding box accurate..

This also rolls back a change in #11627 where constrained_layout was turned off under ZOOM and PAN...

## PR Checklist

- [x] Has Pytest style unit tests
- [x] Code is PEP 8 compliant

<!--
Thank you so much for your PR!  To help us review your contribution, please
consider the following points:

- A development guide is available at https://matplotlib.org/devdocs/devel/index.html.

- Help with git and github is available at
  https://matplotlib.org/devel/gitwash/development_workflow.html.

- Do not create the PR out of master, but out of a separate branch.

- The PR title should summarize the changes, for example "Raise ValueError on
  non-numeric input to set_xlim".  Avoid non-descriptive titles such as
  "Addresses issue #8576".

- The summary should provide at least 1-2 sentences describing the pull request
  in detail (Why is this change required?  What problem does it solve?) and
  link to any relevant issues.

- If you are contributing fixes to docstrings, please pay attention to
  http://matplotlib.org/devel/documenting_mpl.html#formatting.  In particular,
  note the difference between using single backquotes, double backquotes, and
  asterisks in the markup.

We understand that PRs can sometimes be overwhelming, especially as the
reviews start coming in.  Please let us know if the reviews are unclear or
the recommended next step seems overly demanding, if you would like help in
addressing a reviewer's comments, or if you have been waiting too long to hear
back on your PR.
-->

Problem statement:
Bug in tight_layout
 I just found a critical bug in `tight_layout ` in master (unless something is wrong with my installation...).
```
fig, ax=plt.subplots()
fig.set_tight_layout(True)
plt.show()
```
The axes get into a black hole in the middle of the figure if I try to zoom. 
 
master
python 3.5, 3.6 
windows 10

Hints from issue discussion:
It seems that the new tests for correct `subplotparams` in `tight_layout`for some reason don't work in the use case above. I am looking into it.
Some more information. The left, right etc values in the `tight_layout` module became incorrect. Those values get send to `Subplotparams.update` where they are silently changed to the old values. The `raise` ValueError is not working, probably due to a try somewhere. 

So zooming seems to work without the new tests in the `tight_layout` module but it actually doesn't because the old `suplotparameters` are just used once again. 
#11739 might fix the bug.

Commit message: FIX: update spine positions before gett extents

Patch to review:
diff --git a/lib/matplotlib/spines.py b/lib/matplotlib/spines.py
index 5747c40bba69..ee1f6f29af61 100644
--- a/lib/matplotlib/spines.py
+++ b/lib/matplotlib/spines.py
@@ -146,6 +146,12 @@ def get_patch_transform(self):
         else:
             return super().get_patch_transform()
 
+    def get_window_extent(self, renderer=None):
+        # make sure the location is updated so that transforms etc are
+        # correct:
+        self._adjust_location()
+        return self.get_path().get_extents(self.get_transform())
+
     def get_path(self):
         return self._path
 


Code review comments:
diff_hunk: @@ -146,6 +146,12 @@ def get_patch_transform(self):
         else:
             return super().get_patch_transform()
 
+    def get_window_extent(self, renderer=None):
+        # make sure the location is updated so that transforms etc are
+        # correct:
+        self._adjust_location()
+        return self.get_path().get_extents(self.get_transform())
path: lib/matplotlib/spines.py
text: @user1:
`super().get_window_extent(renderer=renderer)` instead?