-
Notifications
You must be signed in to change notification settings - Fork 361
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
GeoAxes._update_title_position
called before Gridliner._labels
is populated
#2390
Comments
Erk. We added a test for the title adjustment at #2249 but it uses constrained layout: currently I guess an easy fix would be to just call In the meantime, a user workaround would be to force an extra draw with |
Actually I think that would only help the very basic case and could go wrong if e.g. the extent changes between adding the |
Oh dang I was literally just writing a patch fix in Iris to do this! |
I mean, I haven’t actually tried… Though the simplest fix for Iris might be to just do this in the test
|
Thus making the test pass but not actually saving the user from the problem when they are out in the real world 😉 The fix in
But putting this at the top of class GeoAxesPatched(cartopy.mpl.geoaxes.GeoAxes):
def _draw_preprocess(self, renderer):
super()._draw_preprocess(renderer)
for artist in self.artists:
if hasattr(artist, "_draw_gridliner"):
artist._draw_gridliner(renderer=renderer)
cartopy.mpl.geoaxes.GeoAxes = GeoAxesPatched |
Fair enough. I was thinking of this as a purely Cartopy bug that Iris has no responsibility for. But in the |
My apologies, I'm being very me-centric 🙉 |
Description
The changes in Cartopy 0.23 mean that plot titles are no longer re-positioned around axis labels.
I have looked into this and it seems to be because
Artist._draw_gridliner
is no longer called withinGeoAxes._draw_preprocess
, meaning that no labels are present whenGeoAxes._update_title_position
is called. See the workaround demonstration below for my hacky fix. Interestingly it does behave correctly if a second save call is made using the same figure.Code to reproduce
Bug demonstration
Workaround demonstration
Full environment definition
Operating system
RHEL7
Cartopy version
0.23
conda list
pip list
The text was updated successfully, but these errors were encountered: