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

Forthcoming ggplot2 release and esmisc #2

Open
paleolimbot opened this issue May 8, 2019 · 0 comments
Open

Forthcoming ggplot2 release and esmisc #2

paleolimbot opened this issue May 8, 2019 · 0 comments

Comments

@paleolimbot
Copy link

paleolimbot commented May 8, 2019

We're in the process of preparing a ggplot2 release. As part of the release process, we run the R CMD check on packages that use ggplot2 to make sure we don't accidentally break code for downstream packages.

In running the R CMD check on esmisc, we identified the following issue:

  • checking examples ... ERROR
    Running examples in ‘esmisc-Ex.R’ failed
    The error most likely occurred in:
    
    > ### Name: theme_edi
    > ### Title: Custom ggplot2 theme
    > ### Aliases: theme_edi
    > 
    > ### ** Examples
    > 
    > library(ggplot2)
    > p <- ggplot(mtcars) + 
    +  geom_point(aes(x = wt, y = mpg, 
    + colour=factor(gear))) + facet_wrap(~am)
    > p
    > p + theme_edi()
    Error in axis.ticks.length.x.bottom %||% axis.ticks.length.x : 
      object 'axis.ticks.length.x.bottom' not found
    Calls: <Anonymous> ... with -> with.default -> eval -> eval -> %||% -> %||%
    Execution halted
    

As part of the new release, we improved the theme() function to allow different lengths of ticks on the top and bottom of the plot. As a result, theme_edi() in esmisc is no longer complete, as it does not inherit from a current ggplot2 theme (like theme_grey()). 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:

# 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(...)

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%

Let us know if we can help! We are hoping to release the next version of ggplot2 in the next two weeks.

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

1 participant