Skip to content

Vertical space between legend keys changed after switching theme? #3180

Closed
@tungttnguyen

Description

@tungttnguyen

Hello,

I noticed there was difference in the vertical space between legend keys when switching between themes e.g. from theme_grey to theme_bw (see the reprex below). I wonder what was the cause of that?

Thanks!

### ggplot2 3.1.0.9000 (2019-03-06)
library(ggplot2)

theme_set(theme_grey(base_size = 14))
p1 <- ggplot(mtcars) +
  aes(fill = factor(cyl), x = cyl) +
  geom_bar() +
  theme(
    legend.key = element_rect(size = 6),
    legend.key.size = unit(1, "cm")
  )
print(p1)

theme_set(theme_bw(base_size = 14))
p2 <- ggplot(mtcars) +
  aes(fill = factor(cyl), x = cyl) +
  geom_bar() +
  theme(
    legend.key = element_rect(size = 6),
    legend.key.size = unit(1, "cm")
  )
print(p2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorthemes 💃tidy-dev-day 🤓Tidyverse Developer Day

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions