Skip to content

DOC: Update style sheet reference #21860

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

Merged
merged 3 commits into from
Jan 5, 2022

Conversation

timhoffm
Copy link
Member

@timhoffm timhoffm commented Dec 4, 2021

  • Exclude internal styles (Closes Style sheet example should skip internal styles #21838)
  • Make style names a bit larger and bold for better readability
  • Use a different curve than sin for the plot lines with colorcycle. - The sin curves have a lot of crossing which makes it hard to follow the colorcycle. - I've still one crossing section included to make it look a bit more interesting, but we could even remove that in case somebody thinks this is still too cluttered.

Also make the style name a bit larger and bold so that it's easier to
read.
@timhoffm timhoffm added this to the v3.5-doc milestone Dec 4, 2021
@jklymak
Copy link
Member

jklymak commented Dec 4, 2021

The one change I made to make the style name a suptitle was more legible in my opinion. I also think it was better as one style so it looked the same for each figure.

@timhoffm timhoffm force-pushed the doc-hide-internal-styles branch from 9aa28df to 529225f Compare December 4, 2021 23:10
@timhoffm
Copy link
Member Author

timhoffm commented Dec 4, 2021

Yes, that's true. I've taken over your suptitles.

mcolors.to_rgb(plt.rcParams['figure.facecolor']))[2]
if back < 0.5:
col = [0.8, 0.8, 1]
fig.suptitle(style_label, x=0.01, fontsize=14, ha='left',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, but many times the fontsizes are are different? https://65288-1385122-gh.circle-artifacts.com/0/doc/build/html/gallery/style_sheets/style_sheets_reference.html It think this is tight_layout making the axes smaller or bigger and then css making all the figures the same size. I think if you switch to constrained_layout this will be better (tight_layout doesn't work with suptitles)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's try with constrained layout.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That didn't work either. I don't really understand why the fontsize is not being respected...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main "problem" with the fontsize seems to be that the different styles define different figure sizes. E.g. compare

default

and

seaborn-poster

The fonts have actually the same size, but the poster is much larger, and thus the png is scaled down to fit in the available width in the theme.

The alternative would be to use an absolute figure size instead of a one relative rcParams['figure.size']. Not sure which is better.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh weird. That hadn't occurred to me. I'd just make the figure a fixed size. That's essentially what we did w the subfigure version and I think that looked ok?

Copy link
Member Author

@timhoffm timhoffm Dec 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done:

It's better to override absolute sizes in the style sheet. Otherwise,
larger figure images are scaled down due to the limited available width
in the html theme. If we don't set a fixed size, we still don't get a size relation, but we
also have different magnifications due to the image scaling.

Notes:

  • The width (7.4 -> 740px, assuming 100 dpi) is chosen to fit in the
    HTML space (749px) without scaling.
  • The height is chosen to approximately keep the aspect ratio as before.
  • The images are now significantly smaller than previously (all former
    images were downscaled). We'll have to verify that the images still
    look good given a lot of information and not much space. If not, we
    need to add a fixed factor again.
  • All themes use figure.dpi=100, except "classic", which uses 80. Not
    correcting for that is intentional. IMHO "classic" should come out
    smaller to highlight the change in dpi.

with less overlapping lines to make the color cycle more obvious.

Co-authored-by: Jody Klymak <jklymak@gmail.com>
It's better to override absolute sizes in the style sheet. Otherwise,
larger figure images are scaled down due to the limited available width
in the html theme. If not, we still don't get a size relation, but we
also have different magnifications due to the image scaling.

Notes:

- The width (7.4 -> 740px, assuming 100 dpi) is chosen to fit in the
  HTML without scaling.
- The size is chosen to approximately keep the aspect ratio as before.
- The images are now significantly smaller than previously (all former
  images were downscaled). We'll have to verify that the images still
  look good given a lot of information and not much space. If not, we
  need to add a factor.
- All themes use figure.dpi=100, except "classic", which uses 80. Not
  correcting for that is intentional. IMHO "classic" should come out
  smaller to highlight the change in dpi.
@jklymak
Copy link
Member

jklymak commented Jan 5, 2022

This looks fine to me. Feel free to self merge if you are done with it...

@timhoffm timhoffm merged commit d9ef0a7 into matplotlib:main Jan 5, 2022
@timhoffm timhoffm deleted the doc-hide-internal-styles branch January 5, 2022 22:39
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Jan 5, 2022
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Jan 5, 2022
timhoffm added a commit that referenced this pull request Jan 6, 2022
…860-on-v3.5.x

Backport PR #21860 on branch v3.5.x (DOC: Update style sheet reference)
timhoffm added a commit that referenced this pull request Jan 6, 2022
…860-on-v3.5.1-doc

Backport PR #21860 on branch v3.5.1-doc (DOC: Update style sheet reference)
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.

Style sheet example should skip internal styles
2 participants