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

geom_sina omits data when there's only one point #51

Closed
ghost opened this issue Dec 8, 2016 · 3 comments
Closed

geom_sina omits data when there's only one point #51

ghost opened this issue Dec 8, 2016 · 3 comments

Comments

@ghost
Copy link

ghost commented Dec 8, 2016

I'm having an issue with geom_sina (a package which I love, by the way) where if there is only one value that value is omitted. Here is a reproducible example:

simple <- data.frame(ID = c(rep(1,7)),
                     group = c("alpha", "beta", "alpha", "beta", "alpha", "beta", "alpha"),
                     version = c("on", "on", "off", "off", "on", "on", "off"),
                     value = c(1:4, 1:3))

ggplot() +   
    geom_point(data = simple, aes(x = ID, y = value, colour = ID),
               position = position_jitter(w = 0.2, h = 0)) +
    theme(legend.position = "none",
          axis.title.y = element_blank()) +
    facet_grid(version ~ group, shrink=FALSE)

ggplot() +   
    geom_sina(data = simple, aes(x = ID, y = value, colour = ID)) +
    theme(legend.position = "none",
          axis.title.y = element_blank()) +
    facet_grid(version ~ group, shrink=FALSE)

That creates two plots. The geom_point plot has all points, but the geom_sina one has omitted the single point in 'beta' x 'off' and gives the following warning:

Warning message:
Removed 1 rows containing missing values (geom_sina).

I suspect the removed row is the single point I wanted plotted. Is there a workaround or fix?

Thanks!

(Edited to fix sample data set)

sidiropoulos added a commit to sidiropoulos/ggforce that referenced this issue Dec 11, 2016
@sidiropoulos
Copy link
Contributor

@Raisinscone this was indeed a bug! I just pushed a fix.

Thanks for reporting!

thomasp85 pushed a commit that referenced this issue Dec 12, 2016
Fixes #41 #48 #51

* Bug fix for classes with one point. 
* Scaling class width to properly match the `maxwidth` parameter. 
* Added a tiny fuzz in ybins.
@thomasp85
Copy link
Owner

Fixed in #52

@ghost
Copy link
Author

ghost commented Dec 12, 2016

Thanks! Glad to have been of help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants