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

theme: Add different ticks length for different axes #2935

Closed
pank opened this issue Oct 11, 2018 · 4 comments
Closed

theme: Add different ticks length for different axes #2935

pank opened this issue Oct 11, 2018 · 4 comments

Comments

@pank
Copy link
Contributor

@pank pank commented Oct 11, 2018

Hi,

I would like to add support for different ticks length for different axes (basically extending axis.ticks.length).
My main motivation is to match an Excel theme that I have been given, which features upwards ticks on the x-axis. I don't want inwards ticks on the y-axis though.

It was first requested in issue #1319.

Related pull request 2934.

My answers to comments submitted to the pull requests:

@batpigandme wrote:

PS As for styling, you can use the styler package to implement the in-house style as described in the tidyverse style guide.

Thanks, I will check that. I think it might also be possible to configure ESS to do tidyverse style these days...

@clauswilke

I've wanted this option in the past, so I'd generally be in favor. Not sure if it can be done without the clutter of adding all these new theme elements.

That's a good idea. We could use a "list" like for margins. Would it make sense to allow axis.ticks.length to be either a unit or a "list" with top, bottom, left, right? Is there any precedence for allowing two types?
The good things about having a new element in theme for each is that it makes auto-completion easy (at least in ESS and I'd assume Rstudio as well, but I'm not sure).

For the theme calculation code, you could probably just write: ...

Thanks! I could see if I within or with works here. That would make is less cluttered as well...

@clauswilke
Copy link
Member

@clauswilke clauswilke commented Oct 11, 2018

There's also another issue, more a question for @hadley: We have a solid inheritance system for elements, but we don't for units, such as axis.ticks.length discussed here or similarly legend.spacing and probably a few others. We always handle unit inheritance in a one-off fashion, as in:

theme$axis.ticks.length.x.bottom <- theme$axis.ticks.length.x.bottom %||% theme$axis.ticks.length.x %||% theme$axis.ticks.length

Would it make sense to add a function that can calculate these units based on the theme and the inheritance tree?

@pank
Copy link
Contributor Author

@pank pank commented Oct 12, 2018

@clauswilke
Copy link
Member

@clauswilke clauswilke commented Apr 17, 2019

Closed via #2934.

@lock
Copy link

@lock lock bot commented Oct 14, 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 Oct 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants