0

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

Phil
  • 7,287
  • 3
  • 36
  • 66
Micah
  • 1
  • 1
  • Could you please explain why you want to use densities to show only 2 values? – Quinten Jul 04 '23 at 08:48
  • Most of the densities in my plot have 5-15 values, but there are a couple that only have two. I would like to leave them in the plot for comparison's sake and overlay jittered points to make the size of the sets clear. – Micah Jul 04 '23 at 20:41

0 Answers0