ggridges geom_density_ridges not plotting with set size of 2

44 Views Asked by At

I'd like to make a Joy plot of a bunch of distributions. A few of my sets only have two numbers and geom_density_ridges skips these sets. However, geom_violin works fine with a set size of 2.

Anybody know why these are different or how to make ggridges draw both sets?

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

0

There are 0 best solutions below