Skip to content

Conversation

@greglucas
Copy link
Contributor

PR Summary

Update the colorbar get_subplotspec() to only access attributes
after a check for it having the attribute, else return None.

Fixes #22576

This will still warn about the Axes not being compatible, but I think that is expected as an AxesGrid inset_axes() without a colorbar also warns.

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

Update the colorbar get_subplotsped() to only access attributes
after a check for it having the attribute, else return None.
@QuLogic QuLogic merged commit 2c463fe into matplotlib:main Mar 7, 2022
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Mar 7, 2022
@greglucas greglucas deleted the axesgrid-inset-cbar branch March 7, 2022 21:39
timhoffm added a commit that referenced this pull request Mar 8, 2022
…611-on-v3.5.x

Backport PR #22611 on branch v3.5.x (FIX: Colorbars check for subplotspec attribute before using)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: inset_axes colorbar + tight_layout raises AttributeError

3 participants