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 · 6 comments · May be fixed by #6192
Open

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

davidhodge931 opened this issue Nov 19, 2024 · 6 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
@davidhodge931
Copy link
Author

Do you want to leave this open as issue (or create an issue) that the extra new boxplot params can't be used with layer?

Or just close for now once the bug bit has been fixed in that it is not that important and can't be done any time soon?

(My bad for mixing 2 issues)

@teunbrand
Copy link
Collaborator

teunbrand commented Nov 20, 2024

the extra new boxplot params can't be used with layer

They can, but they should be lists of colour/linetype/linewidth parameters, as geom_boxplot() handles them.
If you'd like to keep this issue open to get a 2nd opinion, that is fine with me.
If not, I can close it whenever #6192 gets merged.

@davidhodge931
Copy link
Author

Ah, I get it now - nice!

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