Skip to content
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

Themes #258

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open

Conversation

vincentarelbundock
Copy link
Collaborator

@vincentarelbundock vincentarelbundock commented Nov 15, 2024

TODO:

  • y-axis labels in facets for minimal and dark

@grantmcdermott
Copy link
Owner

grantmcdermott commented Nov 15, 2024

This is great and very much aligned with what I was thinking. Thanks for getting it started :-)

I'm pressed for time at work today, but here's a quick laundry list of some additional adjustments that I'd liketinytheme() to account for:

  • tpar options like grid, facet.bg, etc. I'm not sure whether it's worth enabling a separate getHook/setHook mechanism for tpar, or whether we should just set it "manually" inside tinytheme() e.g. tpar(grid =TRUE)?
  • IIRC the setHook("before.plot.new", ...) approach didn't always play nicely with legends (e.g., text adjustments, etc.) this might have been particular to the basethemes() implementation but we should double check.
  • Positioning and font style of the sub argument. Personally, I don't find the default sub implementation useful at all and I always end up customizing my base plot subtitles and captions with ex post calls to title and mtext. (Side note: Maybe we should add a tinyplot(..., caption = NULL) argument to distinguish between captions and subtitles?)
  • Slightly more complicated, but I could imagine a "dynamic" theme that automatically adjusts the plot margin spacing to optimize white space. For example, reducing the top margin if no title is detected. See also Default axis spacing parameters #112.

@vincentarelbundock

This comment was marked as outdated.

@vincentarelbundock

This comment was marked as outdated.

@vincentarelbundock

This comment was marked as outdated.

@grantmcdermott

This comment was marked as outdated.

@vincentarelbundock

This comment was marked as outdated.

@grantmcdermott

This comment has been minimized.

@vincentarelbundock
Copy link
Collaborator Author

Qq: Can you say a bit more about why all of the tests change? I know you mentioned this elsewhere, but it would be good to keep a paper trail here.

Sorry, forgot about that. There were only two visual changes:

  1. Micro-pixel level changes in the main title due to using mtext() instead of title(). This allows us to place subtitle below title on some themes.
  2. Slight color difference in the standard axes. I couldn't trace exactly the source of this in the code, but the new axes are better. If you look at the old ones very closely, you'll notice that the axes are sometimes darker than the box, so the overlay stands out in some portions. Now the colors of box and axes are a better match by default.

Neither change is visible to the naked eye at all.

@grantmcdermott

This comment has been minimized.

@zeileis

This comment has been minimized.

@vincentarelbundock

This comment has been minimized.

@zeileis

This comment has been minimized.

@vincentarelbundock

This comment has been minimized.

@zeileis

This comment has been minimized.

@vincentarelbundock

This comment has been minimized.

@vincentarelbundock

This comment has been minimized.

@zeileis

This comment has been minimized.

@vincentarelbundock

This comment has been minimized.

@grantmcdermott

This comment has been minimized.

@vincentarelbundock

This comment has been minimized.

@zeileis

This comment has been minimized.

@vincentarelbundock
Copy link
Collaborator Author

vincentarelbundock commented Nov 21, 2024

Sold! Sunset and ag_sunset it is.

Edit: no truncation of okabe ito we need 8 colors

@zeileis
Copy link
Collaborator

zeileis commented Nov 22, 2024

The question of truncating palettes is important for any palette in the themes, I think. For qualitative palettes re-ordering would be useful in addition. One way to support this would be to accept not just palette name but also a vector of colors in the theme. Optionally, we can always turn these into a color ramp function which might be useful, especially for sequential and diverging palettes.

In this specific case: Set2 has eight colors (with light gray being the 8th color) while Okabe-Ito has nine colors (with black being 1st and light gray 9th). If we shuffle the colors from the palettes in some suitable way, then we can also find a setup so that the colors roughly match. The benefit of this would be that you could talk about the "blue" and the "green" group, no matter whether you use the light or dark theme.

Another general question is whether the first color should always be black - only be black if there are no groups - or should always be non-black.

I suggest that we defer these questions to a different issue, though. They will likely need more discussion and experimentation. Maybe we should just say on the manual page that the themes are still work in progress or something like that...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants