Skip to content

User-defined theme elements #2741

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

Conversation

clauswilke
Copy link
Member

This is the first step towards user-defined theme elements as discussed in #2540. This particular PR doesn't add any features yet, it just reorganizes the code so that global variables live in an environment. It could be merged as is, but mostly I'd want quick feedback to make sure I'm on the right track.

Copy link
Member

@hadley hadley left a comment

Choose a reason for hiding this comment

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

Looks good.

I had a possible crazy idea - can we make the set of valid aesthetics and the set of valid theme elements a theme setting? That would allow us to use an existing plot-local way of modifying defaults.

@clauswilke
Copy link
Member Author

Let me ponder this. Making the valid theme elements a theme setting might require solving some technical challenges but I think it makes sense conceptually.

For the valid aesthetics, I'm a bit concerned about orthogonality. It might create a zoo of different themes that only differ in the aesthetics they support, e.g. theme_gray() with this extra aesthetic and with that extra aesthetic. And package authors might be tempted to republish those themes under the original ggplot2 names, if they look exactly the same.

@hadley
Copy link
Member

hadley commented Jul 8, 2018

Yeah, and providing valid aesthetics as a theme component makes them a plot level setting, which will make mingling geoms from different packages potentially complex.

Maybe layers should have a property that allows you to define extra aesthetics?

@clauswilke
Copy link
Member Author

I'll go ahead and merge this because I think this reorganization makes sense regardless of how we proceed. I'll move the discussion of the various possibilities to the respective issues.

@clauswilke clauswilke merged commit c1908f1 into tidyverse:master Jul 9, 2018
@yutannihilation yutannihilation mentioned this pull request Sep 26, 2018
25 tasks
@clauswilke clauswilke mentioned this pull request Nov 13, 2018
@lock
Copy link

lock bot commented Jan 5, 2019

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Jan 5, 2019
@clauswilke clauswilke deleted the issue-2540-user-defined-theme-elements branch January 12, 2020 03:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants