Skip to content

custom guide with theme_void() will throw a warning message #5856

@Hy4m

Description

@Hy4m

Greetings

I am trying to add an inside guide with theme_void(), and I'm not sure why throwing a warning message (In rep(padding, length.out = 4) : 'x' is NULL so the result will be NULL). But when we use other theme, it's OK.

Here is a simple example

library(ggplot2) ## 3.5.0.9000
    
    p <- ggplot(mpg, aes(displ, hwy)) + geom_point()
    
    ## it's OK
    p + 
      guides(custom = guide_custom(grid::circleGrob(),
                                     title = "My circle",
                                     width = unit(2, "cm"),
                                     height = unit(2, "cm")))
    
    ## but will throw a warning message when add theme_void()
    p + 
      guides(custom = guide_custom(grid::circleGrob(),
                                   title = "My circle",
                                   width = unit(2, "cm"),
                                   height = unit(2, "cm"))) +
      theme_void()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorguides 📏

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions