tidyverse / ggplot2

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

layer code with geom = "rug" no longer works as expected in Development version #5940

Open davidhodge931 opened 3 weeks ago

davidhodge931 commented 3 weeks ago

The below code works in 3.5.1, but now does not in the Development version.

I know layer() is not the conventional way to create a rug plot - but I am using this code under the hood in my ggplot2 extension package - and now it breaks with rug.

Maybe this has something to do with the outside = FALSE, sides = bl, length = 0.03 defaults in geom_rug??

library(tidyverse)
library(palmerpenguins)

geom_rug()
#> geom_rug: outside = FALSE, sides = bl, length = 0.03, na.rm = FALSE
#> stat_identity: na.rm = FALSE
#> position_identity

palmerpenguins::penguins |>
  ggplot() +
  layer(
    geom = "rug",
    stat = "identity",
    position = "identity",
    mapping = aes(x = flipper_length_mm, y = body_mass_g, col = sex),
  )
#> Error:
#> ! Problem while converting geom to grob.
#> ℹ Error occurred in the 1st layer.
#> Caused by error in `if (grepl("b|t", params$sides)) ...`:
#> ! argument is of length zero

Created on 2024-06-08 with reprex v2.1.0