Skip to content

Cannot set legend.box.background with theme_void() #2723

@clauswilke

Description

@clauswilke

It doesn't seem possible to set the legend.box.background theme setting under theme_void(). Other legend settings work.

Reprex:

library(ggplot2)
df <- data.frame(x = 1:3)
ggplot(df, aes(x, x, color = factor(x))) +
  geom_point() +
  theme_void() +
  theme(legend.background = element_rect(fill = "gray80"))

df <- data.frame(x = 1:3)
ggplot(df, aes(x, x, color = factor(x))) +
  geom_point() +
  theme_void() +
  theme(legend.box.background = element_rect(fill = "gray80"))
#> Warning in if (theme$legend.box == "horizontal") {: the condition has
#> length > 1 and only the first element will be used
#> Warning in if (theme$legend.box == "vertical") {: the condition has length
#> > 1 and only the first element will be used
#> Error in gtable_add_cols(guides, theme$legend.box.margin[4], pos = 0): is.gtable(x) is not TRUE

Created on 2018-06-28 by the reprex package (v0.2.0).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions