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

tinyplot themes #234

Open
grantmcdermott opened this issue Oct 11, 2024 · 1 comment
Open

tinyplot themes #234

grantmcdermott opened this issue Oct 11, 2024 · 1 comment

Comments

@grantmcdermott
Copy link
Owner

Similar to ggplot2's built-in themes, it would be cool if we could support a minimal set of tinyplot themes.

Some quick thoughts:

  • In the vignette, we point users to the (excellent) basetheme package. But I've noticed that basetheme doesn't always play well with some of tinyplot's unique features, particularly w.r.t. faceting and legend text. OTOH I really like the general design and implementation using hooks. Perhaps we could borrow from these ideas.

  • If we were being ambitious, we could look at dynamically resizing plot margins and margin gaps (mgp) to reduce/optimize whitespace for certain themes. Specifically, this behaviour would depend on criteria like whether main and axis titles are provided, whether las = 1, etc. The UX trade-off here would be that users potentially couldn't add, say, titles afterwards. But I think the general aim of tinyplot is to take care of plot arrangement in a single function call anyway, so that doesn't seem so bad a tradeoff to me. (Related: Default axis spacing parameters #112)

  • Ideally, users could set themes globally (via tpar() or a dedicated tinytheme() function?), or directly for an individual plot via a tinyplot(..., theme = <theme_string>) argument.

  • One minor thing I'd like to support is positioning and font styles of titles. To highlight one thing: personally, I've never liked the default position and styling of sub, since it feels like a clunky part of the x-axis title, rather than an actual subtitle (which I'd expect below the main title.) Come to think of it, maybe we should introduce a separate caption argument...

@zeileis
Copy link
Collaborator

zeileis commented Oct 13, 2024

Regarding the themes, I agree with your suggestions. But I cannot contribute much at the moment because I'm not familiar with the details of how basetheme works (and where it doesn't work).

Regarding the dynamic resizing, I agree this would be useful in many situations, especially when there is no main title and we just waste a lot of space. However, I would make that functionality optional in order to keep the compatibility with the base plot() function (which is also one of the design goals, isn't it?).

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

No branches or pull requests

2 participants