-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
DOC: fix stylesheet again #21796
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
DOC: fix stylesheet again #21796
Conversation
99ff693
to
ce71ef2
Compare
ce71ef2
to
412c1da
Compare
da79690
to
ee4f516
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really like the subfigures solution because of the workarounds needed for figure-related styling.
Overall, I'd rather have sphinx gallery behaving and not us working around that. But maybe this PR is the quickest stop-gap on our side.
fig, axs = plt.subplots(ncols=6, nrows=1, num=style_label, | ||
figsize=fig_size, squeeze=True) | ||
axs[0].set_ylabel(style_label) | ||
axs[0].figure.set_facecolor(plt.rcParams['figure.facecolor']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a workaround because all subfigures are created with one style. This will not be needed for standard use cases where one has one figure only. I think this workaround needs a comment.
Are there more figure-based parameters that would need to be adapted?
col = np.array([19, 6, 84])/256 | ||
back = mcolors.rgb_to_hsv( | ||
mcolors.to_rgb(plt.rcParams['figure.facecolor']))[2] | ||
if back < 0.5: | ||
col = [0.8, 0.8, 1] | ||
axs[0].figure.suptitle(style_label, x=0.03, fontsize=12, | ||
ha='left', color=col) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seemingly obscure workaround needs a comment as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes fair. I don't really consider this example a code example so wasn't too worried about being didactic. Also this suptitle is not meant to illustrate the styles - it was meant to be distinct.
Co-authored by: David Stansby <dstansby@gmail.com>
ee4f516
to
25b881f
Compare
BTW, I have no idea if sphinx-gallery can be made to do a one-column layout, and wouldn't object to that solution at all. |
We already override some sphinx-gallery CSS in |
Adding to .sphx-glr-multi-img {
max-width: 100%;
} appears enough, but we'd have to check how much this affects other pages. It would also affect:
|
I've gone through all figures listed above, and I think they all look better at full resolution, except that some of them really should be split up (with text that's already there sometimes), thus avoiding this styling entirely. The only two figures that make sense to go together are at https://matplotlib.org/stable/tutorials/colors/colors.html#cn-color-selection, but they happen to work anyway because they're small enough to fit on one line. |
Sure if we prefer a css solution I'm fine with that! |
See #21837; that avoids having to do the subfigure stuff here, but I think there are still some fixes here we might still want (e.g., skipping internal styles)? |
Superseeded by #21837. |
PR Summary
This makes the stylesheet one figure (with subfigures) to allow us to better control the legibility (I hope)
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).