-
Notifications
You must be signed in to change notification settings - Fork 108
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
Missing theme elements in ggplot2 3.1 #31
Comments
Probably related to this recent commit from |
@tungmilan - it looks like you've noted this already. The way that ggthemer defines its themes makes it difficult for us to improve themes without breaking code in your package. We recommend using code like the following to define new themes, so that we can continue to improve the ggplot2 theme system without breaking others' code: theme_custom <- function(base_size = 11, base_family = "",
base_line_size = base_size/22, base_rect_size = base_size/22) {
# Starts with theme_grey and then modify some parts
ggplot2::theme_grey(
base_size = base_size,
base_family = base_family,
base_line_size = base_line_size,
base_rect_size = base_rect_size
) %+replace%
ggplot2::theme(
# insert your custom theme elements here
)
} For this to work, you will have to import #' @importFrom ggplot2 %+replace% Even if you seemingly override every element, inheriting from an existing ggplot2 theme will make it easier for us to add elements in the future. Let me know if I can help! We are hoping to release the next version of ggplot2 in the next two weeks. |
@paleolimbot Thanks, I'll take a look at this, sometime this week. |
Can replicate on Travis: https://travis-ci.org/krlmlr/ggthemr/jobs/532527507#L2305. |
ggplot2 just updated 6 days ago to 3.1.1. Loading a ggthemr theme now throws the following message:
Warning message:
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
Calling ggplot now results in the following error:
Error in axis.ticks.length.x.bottom %||% axis.ticks.length.x :
object 'axis.ticks.length.x.bottom' not found
Any chance these elements can be specified in the themes or is there a workaround? Thank you!
The text was updated successfully, but these errors were encountered: