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

Some themes in downstream packages are currently not valid #3310

Closed
paleolimbot opened this issue May 8, 2019 · 11 comments
Closed

Some themes in downstream packages are currently not valid #3310

paleolimbot opened this issue May 8, 2019 · 11 comments
Milestone

Comments

@paleolimbot
Copy link
Member

In the revdep check (#3303), packages that define complete themes fail because the themes don't contain all required elements (several were added by #2934).

In addition, some rstan dependencies fail on stan_plot() (breathteststan) and stan_hist() (fergm). rstan defines the default theme at package build time instead of within a function, which might be the cause of these failures.

@clauswilke
Copy link
Member

I think these are all cases where all we can do is inform the package maintainers that they need to fix their code.

@paleolimbot Could you reach out to them? And also recommend to them the %+replace% pattern for development of new themes?

ggplot2/R/theme-defaults.r

Lines 245 to 252 in 3b69172

# Starts with theme_grey and then modify some parts
theme_grey(
base_size = base_size,
base_family = base_family,
base_line_size = base_line_size,
base_rect_size = base_rect_size
) %+replace%
theme(

@paleolimbot
Copy link
Member Author

paleolimbot commented May 8, 2019

On it.

Is there a reason that using validate = TRUE doesn't check for all required elements when complete = TRUE? Right now this is failing at draw time with a cryptic error message, rather than when the theme is created and validated.

@clauswilke
Copy link
Member

Many parts of the theme code need revising, including how validation works, but that's for another day. I plan to look into it seriously once this release is out the door.

@paleolimbot
Copy link
Member Author

Sorry, one more theme-related question. Is there a way to use something that isn't an infix operator to replace theme elements? With %+replace% I have to suggest that people do

#' @importFrom ggplot2 %+replace%

which means that some packages that have ggplot2 in Suggests may have to put it in Imports (I think?). I suppose they could also do:

`%+replace%` <- ggplot2::`%+replace%`

@paleolimbot
Copy link
Member Author

@clauswilke
Copy link
Member

It's unclear to me why xpose breaks. There's something I don't understand yet. They use the recommended pattern and it should work.

@paleolimbot
Copy link
Member Author

I should have checked xpose more carefully...those themes aren't the problem

@clauswilke
Copy link
Member

Thanks!

@tungttnguyen
Copy link

I didn't see you mentioned ggthemr but it broke after #2934 too

library(ggthemr)
ggthemr('dust')

#> Warning: New theme missing the following elements: axis.ticks.length.x,
#> axis.ticks.length.x.top, axis.ticks.length.x.bottom, axis.ticks.length.y,
#> axis.ticks.length.y.left, axis.ticks.length.y.right

@paleolimbot
Copy link
Member Author

It looks like you've already noted this in Mikata-Project/ggthemr#31 . I'm not sure why our checks didn't catch ggthemr, but feel free to discuss on the ggthemr issue.

@lock
Copy link

lock bot commented Nov 8, 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 Nov 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants