Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: layer(geom = "boxplot",...) produces error #6191

Open
davidhodge931 opened this issue Nov 19, 2024 · 3 comments · May be fixed by #6192
Open

Bug: layer(geom = "boxplot",...) produces error #6191

davidhodge931 opened this issue Nov 19, 2024 · 3 comments · May be fixed by #6192
Labels
bug an unexpected problem or unintended behavior

Comments

@davidhodge931
Copy link

Wondering if it was possible to make the extra args (.e.g. median.colour) added to boxplot could also available via layer?

library(tidyverse)
library(palmerpenguins)

penguins |>
  ggplot(aes(    y = flipper_length_mm,
                 x = species)) +
  geom_boxplot(
    median.colour = "red",
  )
#> Warning: Removed 2 rows containing non-finite outside the scale range
#> (`stat_boxplot()`).

penguins |>
  ggplot(aes(    y = flipper_length_mm,
                 x = species)) +
  layer(
    geom = "boxplot",
    stat = "boxplot", 
    position = "dodge2",
    params = list(median.colour = "red"),
  )
#> Warning: Ignoring unknown parameters: `median.colour`
#> Removed 2 rows containing non-finite outside the scale range
#> (`stat_boxplot()`).

Created on 2024-11-20 with reprex v2.1.1

@teunbrand
Copy link
Collaborator

The answer on whether this is possible is 'yes'.
My answer on whether this should happen is 'probably not'.
There are just too many dang arguments to pass around.
As the one who implemented these, I'm a bit biased of course.
I'm happy to implement something else if you can get one of the other maintainers on board.

@davidhodge931
Copy link
Author

Ahh, I see..

Maybe related to this is that layer seem to error for boxplot with a colour/fill aesthetic?

library(tidyverse)
library(palmerpenguins)

penguins |>
  ggplot(aes(x = species, y = flipper_length_mm, colour = species)) +
  layer(
    geom = "boxplot",
    stat = "boxplot",
    position = "dodge2",
  )
#> Warning: Removed 2 rows containing non-finite outside the scale range
#> (`stat_boxplot()`).
#> Error in unit(x, default.units): 'x' and 'units' must have length > 0

Created on 2024-11-20 with reprex v2.1.1

@teunbrand
Copy link
Collaborator

You're right about that related case and I'm happy to fix that to ensure layer(geom = "boxplot") works

@teunbrand teunbrand added the bug an unexpected problem or unintended behavior label Nov 19, 2024
@davidhodge931 davidhodge931 changed the title Could the new boxplot extra features be available through `layer' too? Bug: `layer(geom = "boxplot",...)' produces error Nov 19, 2024
@davidhodge931 davidhodge931 changed the title Bug: `layer(geom = "boxplot",...)' produces error Bug: layer(geom = "boxplot",...) produces error Nov 20, 2024
@teunbrand teunbrand linked a pull request Nov 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants