Gallery: show colour bar stealing space from multiple axes#5537
Gallery: show colour bar stealing space from multiple axes#5537trexfeathers merged 4 commits intoSciTools:mainfrom
Conversation
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5537 +/- ##
=======================================
Coverage 89.41% 89.41%
=======================================
Files 89 89
Lines 22539 22539
Branches 5387 5387
=======================================
Hits 20154 20154
Misses 1639 1639
Partials 746 746 ☔ View full report in Codecov by Sentry. |
|
I was totally expecting a failure because the reference image needs updating 😕 |
|
trexfeathers
left a comment
There was a problem hiding this comment.
Looks good! I'm happy that this works, and it's definitely more elegant / more idiomatic Matplotlib. I prefer the second approach - the one currently in the PR - as it is more typical Iris use with less to explain.
Got one thing I'd be keen for you to change in the What's New.
|
I think I also need to update the test data version? |
Yes please, thanks for the reminder |
Co-authored-by: Martin Yeo <40734014+trexfeathers@users.noreply.github.com>
b7e53d3 to
e9bc206
Compare
|
Thanks @trexfeathers 😀 |
* upstream/main: moved latest warning banner logic to conf.py (SciTools#5508) updated layout of top navbar (SciTools#5505) Oblique and Rotated Mercator (SciTools#5548) [pre-commit.ci] pre-commit autoupdate (SciTools#5549) [pre-commit.ci] pre-commit autoupdate (SciTools#5527) Bump scitools/workflows from 2023.09.1 to 2023.10.0 (SciTools#5540) nep29 drop table schedule numpy>1.21 (SciTools#5525) Updated environment lockfiles (SciTools#5545) Replaced `NotImplementedError` with `NotImplemented` (SciTools#5544) Gallery: show colour bar stealing space from multiple axes (SciTools#5537) Updated environment lockfiles (SciTools#5524) Set some memory benchmarks to on-demand to reduce noise. (SciTools#5481) updating docs and stale comment (SciTools#5522) Ensure removal of release candidate from What's New title. (SciTools#5526) Updated environment lockfiles (SciTools#5513) Docs page on filtering warnings (SciTools#5509) Replaced pkg_resources version parser with packager version parser. (SciTools#5511) Categorise warnings (SciTools#5498) Updated all np.product calls to np.prod (SciTools#5493)
🚀 Pull Request
Description
It was embarrassingly recent that I realised you can get Matplotlib to automatically place a colour bar across multiple axes. Probably because I originally came to the Iris gallery to learn this sort of thing. This PR modifies one example to show such placement rather than manually placing a colour bar axes. Note that we also have the GloSea example showing manual colour bar placement.
I have two versions of this in the two commits. In the first commit, I created Cartopy GeoAxes up front so that I could pass the original array of axes to
colorbar. I the second commit, I reverted that and found a different way to get hold of the GeoAxes that Iris auto-creates. I am in two minds which is the right version to keep: I think the first version is Better Object Oriented Code, but the second version better illustrates Iris' capabilities (and gotchas).Consult Iris pull request check list