ggplot2 icon indicating copy to clipboard operation
ggplot2 copied to clipboard

Resolution of `geom_tile()` per panel

Open teunbrand opened this issue 4 months ago • 1 comments

This PR aims to fix #5740.

Briefly, when width and height are missing, these are inferred from the data. In #5125, resolutions were computed per panel instead of over the whole layer. This PR follows that approach but for geom_tile().

Reprex from issue:

devtools::load_all("~/packages/ggplot2/")
#> ℹ Loading ggplot2

data <- data.frame(x = rep(seq(0, 1, length.out = 11), each = (11) * 2),
                   y = c(seq(100, 200, length.out = 11), seq(0, 1, length.out = 11)),
                   z = rnorm(((11) ** 2 * 2)),
                   var = rep(c("T1", "T2"), each = 11))

ggplot(data) +
  geom_tile(aes(x = x, y = y, fill = z)) +
  facet_wrap(vars(var), scales = "free_y")

Created on 2024-03-11 with reprex v2.1.0

teunbrand avatar Mar 11 '24 08:03 teunbrand

Quick to note to self: should update to reflect #5765 if that gets merged first.

teunbrand avatar Mar 11 '24 12:03 teunbrand