tidyverse / ggplot2

An implementation of the Grammar of Graphics in R
https://ggplot2.tidyverse.org
Other
6.51k stars 2.03k forks source link

Regression: negative geom_col disappears #6088

Closed olivroy closed 1 month ago

olivroy commented 1 month ago
data.frame(
  x = c(-1, 1),
  y = c("x", "y")
) |> 
  ggplot(aes(x, y)) +
  geom_col()

3.5.1

image

dev image

teunbrand commented 1 month ago

Thanks for the report! Seems to be due to #5789, it only occurs with position = "stack". The following line; https://github.com/tidyverse/ggplot2/blob/eec7490297d9b5d463f96dc8395285542923b94f/R/position-stack.R#L173 Causes the 0-width geometry. The early-exit point from #5789 is before the correct geometry is restored.