-
Notifications
You must be signed in to change notification settings - Fork 2k
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
position = "jitter"
and position = position_jitter()
have different behavior
#2507
Comments
I think maybe this is only a problem with position objects not geoms and stats, because geoms and stats have their state stored elsewhere. I think if you supply |
I agree that In any case, I'm pretty certain the same problem arises with geoms and stats, because I've run into it repeatedly. For example, all the |
Never mind, things seems to be working fine for geoms and stats. Not sure why it doesn't (or didn't) work with my code, but I can't reproduce the problem with |
I think the difference is that the params for stats and geoms are stored in the layer; the params for the position adjustment are stored in the position object. It's a weird design. I'm pretty sure this is not a regression, so I'm going to remove it from the 2.3.0 milestone. |
If this is still worth fixing, it could be done by moving the seed-sanitizing lines: Lines 48 to 51 in 7f317d4
to Lines 67 to 73 in 7f317d4
and adding Lines 64 to 68 in 7f317d4
Many |
Hi, Is it possible to plot the dots organised using geom_jitter? |
I noticed today that
position = "jitter"
is not the same asposition = position_jitter()
, and the behavior described in the documentation forposition = position_jitter()
cannot be obtained forposition = "jitter"
. The underlying issue is a ggproto behavior that has caught me off guard many times (see below).First the reprex. We start with a simple plot with jitter:
The following code produces different jitter:
However, this reproduces the jitter from the first example:
The problem is that
position = "jitter"
does not use the default arguments defined inposition_jitter()
, and thereforeseed
is set toNULL
, not toNA
, when we useposition = "jitter"
. This same problem happens generally with ggproto, e.g. when we call a geom withgeom_*()
vs.geom = "*"
, and it has bitten me many times in different scenarios.There are two ways to fix this particular problem:
The simple way: Don't set
seed = NA
as default inposition_jitter()
.The complicated way: Fix the ggproto behavior so the default arguments apply when objects are specified by their name.
The text was updated successfully, but these errors were encountered: