Repository navigation
Make default facecolor for subfigures be transparent ("none"). Fix for issue #24910 - #25255
Conversation
There was a problem hiding this comment.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a while, please feel free to ping @matplotlib/developers or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
|
This seems good. Perhaps add a change note, and also please include some description in the PR... It's possible your image comparison fails because the wrong version of freetype? https://matplotlib.org/stable/devel/dependencies.html#c-libraries |
| facecolor : default: :rc:`figure.facecolor` | ||
| The figure patch face color. | ||
| facecolor : default: ``"none"`` | ||
| Transparent face color. |
There was a problem hiding this comment.
| Transparent face color. | |
| The figure patch face color; transparent by default. |
or similar. The point is that any color could be passed.
There was a problem hiding this comment.
I think you committed this suggestion, but then it got clobbered in the git confusion. Easily done.
There was a problem hiding this comment.
You are right. Sorry about that. I amended the commit to add it back in.
|
|
||
|
|
||
| @image_comparison(['figure_suptitle_subfigures'], | ||
| extensions=['png']) |
There was a problem hiding this comment.
| extensions=['png']) | |
| extensions=['png'], style='mpl20') |
Not compulsory, but the newer style is preferred. If you decide to change this, the image will also need replacing. Adding and replacing an image in separate commits in the same PR will cause a CI failure, so you would also need to squash the commits down to one. So whether you take this suggestion should depend on how confident you feel with git!
There was a problem hiding this comment.
Thanks @rcomer, I made the changes you suggested. I also squashed down the commits to avoid the image change issue in the CI pipeline.
There was a problem hiding this comment.
Well, looks like the added-modified check on that image failed. I'll investigate and get it sorted.
93009ae to
775ad94
Compare
jklymak
left a comment
There was a problem hiding this comment.
This looks good, but not sure we need a visual test...
|
|
||
|
|
||
| @image_comparison(['figure_suptitle_subfigures'], | ||
| extensions=['png'], style='mpl20') |
There was a problem hiding this comment.
I'm not sure we really need a visual test here... It should be enough to check that facecolor="none" for the subfigure by default, no?
There was a problem hiding this comment.
I can see either way. I guess removing the visual test would keep the build time minimal. However, having the visual test provides some protection if another subtle change impacts the way the subfigures can hide the suptitle. If you think that risk is minimal because the behavior is well understood, I'm happy to remove it.
There was a problem hiding this comment.
The suptitle is under the subfigure (if subfigure is called first). There isn't much to be done about that without using a layout manager. So I'd argue either the subfigure has a clear face or it doesn't is all we can test here. If something else ends up in the subfigure that is not clear, then the suptitle will disappear anyway.
There was a problem hiding this comment.
Ok I will update the PR to:
(1) Remove the visual test
(2) Add a new test that creates the figure and checks for the default clear face on the subfigures. (And maybe a non-default value test too.)
|
Note to pass the Cleanliness check you will need to squash the commits. If in doubt about how to do that, suggest you back up to a backup branch. |
a20c16b to
b82dc38
Compare
b82dc38 to
9d827a8
Compare
|
Thanks @robrighter, I think this is ready to merge, but... @jklymak I'm not sure what milestone this should go in: from the issue's point of view it's a bugfix, which would normally go in v3.7.1. However, since this changes a default, it's likely to break someone. I understand that's OK to do without warning since subfigures are provisional, but maybe not in a patch release? |
|
Thanks @robrighter I squashed your commits before merging. Congratulations on your first PR to Matplotlib! @rcomer, I think you are right that this is too big a change for a bug fix release. But I don't feel strongly about it if someone wants to argue for a backport to 3.7.1 |
…r issue matplotlib#24910 (matplotlib#25255) * RR - Set default facecolor for subfigures to be none (Transparent). Fixes issue matplotlib#24910 * RR - Resolve merge conflict
…r issue matplotlib#24910 (matplotlib#25255) * RR - Set default facecolor for subfigures to be none (Transparent). Fixes issue matplotlib#24910 * RR - Resolve merge conflict
…r issue matplotlib#24910 (matplotlib#25255) * RR - Set default facecolor for subfigures to be none (Transparent). Fixes issue matplotlib#24910 * RR - Resolve merge conflict
PR Summary
This issue was written because the solid facecolor on subfigures was hiding the parent figure suptitle. A few solutions were identified and discussed in the issue thread #24910 . It was decided that the best solution is to change the default facecolor value to "none" (transparent). This PR makes that change.
PR Checklist
Documentation and Tests
pytestpasses)Release Notes
.. versionadded::directive in the docstring and documented indoc/users/next_whats_new/.. versionchanged::directive in the docstring and documented indoc/api/next_api_changes/next_whats_new/README.rstornext_api_changes/README.rst