Open RPDcoetic opened 5 years ago
Probably related to this recent commit from ggplot2
@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 %+replace%
into your package namespace, which you can do by adding the following line to any roxygen documentation block:
#' @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!