ggupset icon indicating copy to clipboard operation
ggupset copied to clipboard

Empty sets are counted and are unaffected by 'sets' argument

Open allenbaron opened this issue 2 years ago • 2 comments

The first example provided with scale_x_upset() includes counts for empty sets (3rd bar). I'm can't decide whether this is expected or not but I thought it worth noting in case others come across it and are surprised by it.

library(ggupset)
library(ggplot2)

ggplot(tidy_movies[1:100, ], aes(x=Genres)) +
  geom_bar() +
  scale_x_upset(reverse = TRUE, sets=c("Drama", "Action"))
#> Warning: Removed 33 rows containing non-finite values (stat_count).

Created on 2023-01-06 with reprex v2.0.2

allenbaron avatar Jan 06 '23 23:01 allenbaron

Hey, thanks for posting this. I agree that this behavior can be surprising but also think that this is the more consistent behavior, so I have no plans to change it .

But I also agree it might be helpful to have it documented in case someone else runs it the behavior, so I will leave this issue open.

Best, Constantin

const-ae avatar Jan 07 '23 10:01 const-ae

I agree that it does make things more consistent. I'm embarrassed to say that I was confused by it 😅. Would you consider documenting it in the manual for scale_x_upset()?

allenbaron avatar Jan 11 '23 15:01 allenbaron