Skip to content

tinyplot themes #234

@grantmcdermott

Description

@grantmcdermott

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions