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

Odd behaviour of geom_quasirandom when colouring by a factor #83

Closed
francoiskroll opened this issue Apr 17, 2023 · 1 comment
Closed
Labels
bug fixed-in-dev issues that have been resolved but not reflected in CRAN

Comments

@francoiskroll
Copy link

francoiskroll commented Apr 17, 2023

Thanks for an amazingly useful package!

I am having an odd issue (maybe caused by a recent update?), which I have just posted on StackOverflow:

https://stackoverflow.com/questions/76034230/r-ggplot2-odd-behaviour-of-geom-quasirandom-when-colouring-by-a-factor

Am I doing something stupid?


Edit: adding group=1 solves this issue (thanks stefan on StackOverflow), like:

ggplot(mtcars, aes(x=factor(gear), y=drat, group=1, color=factor(cyl))) +
  geom_quasirandom()

But I did not have to do this previously, so maybe this is not the expected behaviour regardless?

@csdaw
Copy link
Collaborator

csdaw commented Apr 22, 2023

Thanks, this seems to be a bug introduced in a recent update, as it works as you describe in v0.6.0 (see below).

I believe the intended behaviour should be the points don't move when coloured, unless position = position_dodge() is specified.

I'll look into it.

library(ggbeeswarm)
#> Loading required package: ggplot2

packageVersion("ggbeeswarm")
#> [1] '0.6.0'

## Quasirandom
# this is correctly placing the dots:
ggplot(mtcars, aes(x=factor(gear), y=drat)) +
  geom_quasirandom()

# still correct
ggplot(mtcars, aes(x=factor(gear), y=drat, color=factor(cyl))) +
  geom_quasirandom()

Created on 2023-04-22 with reprex v2.0.2

@eclarke eclarke added bug fixed-in-dev issues that have been resolved but not reflected in CRAN labels Apr 29, 2023
@eclarke eclarke mentioned this issue Apr 29, 2023
eclarke added a commit that referenced this issue Apr 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fixed-in-dev issues that have been resolved but not reflected in CRAN
Projects
None yet
Development

No branches or pull requests

3 participants