-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
turn off the grid after creating colorbar axes #22216
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
Conversation
I have a slight preference to use a rcParams context manager here over-ride |
36db9ca
to
6914544
Compare
Can you also add a test that we do not get warnings on colorbars even with grid-full rcParams settings? |
I agree that colorbar axes should not have grids on by default irrespective of the 'axes.grid' setting. However, technically this is prematurely expiring the deprecation: There can be cases with contours and 'axes.grid'-True styles that have visible grids. It's unlikely that people want that, but if so, we would break their plot. The clean way is to not warn in the deprecation in case of To be clear: This PR should go in as well, but we should decide whether we want to wait until the deprecation expires or whether it's ok to immediately remove grids from colorbar axes. |
Sure, I will do that. |
I have made an attempt to add a test (not too happy with it though). The test is making sure that there are no warnings raised (instead of checking for absence of the specific warning in question). I would appreciate any suggestions to improve the test. |
@pharshalp We talked about this on the call and the consensus is that everyone else but me liked your initial implementation better, can you please switch it back? Sorry for the thrashing. We have also have warning -> fail set up in our test running so you do not need that context manager, if it warns, it will fail. |
7bb4313
to
f6a54ab
Compare
f6a54ab
to
902922a
Compare
@tacaswell thanks for the feedback. I have followed the suggestions (reverted to the earlier approach and cleaned up the test). |
PR Summary
This PR turns the grid off for the colorbar axes created automatically (when user doesn't explicitly specify
cax
) byfig.colorbar
or 'plt.colorbar'. This is needed since Auto-removal of grids by pcolor() and pcolormesh is deprecated.possibly closes #21723?
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).