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

Fine grained theme settings #1458

Open
llrt opened this issue Jun 16, 2020 · 4 comments
Open

Fine grained theme settings #1458

llrt opened this issue Jun 16, 2020 · 4 comments

Comments

@llrt
Copy link

llrt commented Jun 16, 2020

Hi,

First, I would like to thank and congratulate everyone involved for this neat, amazing package! Nice job, guys!

I would like to reproduce in my plots in Gadfly a ggplot BBC-like style (https://github.com/bbc/bbplot/blob/master/R/bbc_style.R), but current settings differs a lot in detail. My current pains and suggestions are:

  • settings for axis and titles are unified in a major label setting -> should it be made available in separate?
  • no settings available for subtitle info -> this is one is bigger, but it would be nice to have
  • no way to attach explicit (Compose?) element objects, replacing entire specific plot blocks, like it's possible in ggplot2 -> even bigger, but it would be so nice to have

Thank you all!

@Mattriks
Copy link
Member

Can you give an example of what you are trying to do in your 3rd dotpoint? It's definitely possible to mix Compose graphics and Gadfly plots.

@llrt
Copy link
Author

llrt commented Jun 17, 2020

@Mattriks I would like to do something along those lines below in R (example from bbplot repo):

axis.ticks = ggplot2::element_blank(),

axis.line = ggplot2::element_blank(),

panel.grid.major.y = ggplot2::element_line(color="#cbcbcb"),

strip.background = ggplot2::element_rect(fill="white"),

strip.text = ggplot2::element_text(size = 22, hjust = 0)

Basically. when element_text is present, a label is drawn; when element_blank is present, that block is suppressed. And you can add other elements, like lines, logos, etc.

@Mattriks
Copy link
Member

Mattriks commented Jan 19, 2021

For text, this would be easy to implement:

  1. Add 5 new Theme fields: major_label (or major_label_text), minor_label, point_label, key_title, key_label, which will accept the new struct in 2.
  2. Create a new struct e.g. struct TextFormat with fields font, fontsize, color, padding etc.
  3. Mark old Theme fields (major_label_font etc) for deprecation
  4. Update code for Guides, e.g. Guide.xlabel, Guide.ylabel etc allowing a transition to the new Theme fields.

I think this is a nicer syntax, and has some advantages (easy to add new fields e.g. padding #1514)

Comments? Name suggestions for the new struct in 2 welcome!

@llrt
Copy link
Author

llrt commented Jan 26, 2021

For text, this would be easy to implement:

  1. Add 5 new Theme fields: major_label (or major_label_text), minor_label, point_label, key_title, key_label, which will accept the new struct in 2.
  2. Create a new struct e.g. struct TextFormat with fields font, fontsize, color, padding etc.
  3. Mark old Theme fields (major_label_font etc) for deprecation
  4. Update code for Guides, e.g. Guide.xlabel, Guide.ylabel etc allowing a transition to the new Theme fields.

I think this is a nicer syntax, and has some advantages (easy to add new fields e.g. padding #1514)

Comments? Name suggestions for the new struct in 2 welcome!

Nice suggestion! I think this shall address many points in the original request, making the API cleaner. I agree with suggested approach.

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