wilkelab / ggridges

Ridgeline plots in ggplot2
https://wilkelab.org/ggridges
GNU General Public License v2.0
411 stars 31 forks source link

Set size of 2 plotting issue. #86

Open micahgearhart opened 1 year ago

micahgearhart commented 1 year ago

Reposting from stackoverflow as I believe this is a bug.

A few of my sets for my plot only have two values and geom_density_ridges draws the categorical labels on the y-axis but doesn't plot any data. geom_violin, on the other hand, works fine with a set size of 2. Also, if I add jittered points to the plot they are not drawn for the n=2 sets.

Reproducible example:

df<-data.frame(class=factor(c("a","a","a","b","b")),value=c(2,4,5,2,3))
ggplot(df,aes(y=class,x=value)) + geom_violin()
ggplot(df,aes(y=class,x=value)) + geom_density_ridges()

sessionInfo:

R version 4.2.2 (2022-10-31) ggplot2_3.4.2 ggridges_0.5.4