Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I an trying to plot 6 groups, in which 3 has a good amount of counts (ranging from 20 to 400) and the rest 3 have very small counts (1 to 9). I want to plot the distribution of a continuous variable within each of these 6 groups and be very honest in the plot about the dramatically different sizes of the groups. I am thinking about generating violin plot for the 3 groups with larger counts to show both the median and the dispersion, and for the low-count groups, plot stripchart to show individual data points.

Could anyone kindly help me find a way to do such a hybrid plot? Other plot suggestions are also welcome.

share|improve this question
    
In some particular package? –  Glen_b Apr 13 at 11:41

1 Answer 1

up vote 4 down vote accepted

Here's a basic one done in R:

# make some data
y1=rnorm(1,10);y2=rnorm(5,9);y3=rnorm(9,10.5)
y4=rnorm(20,9.5);y5=rnorm(90,11);y6=rnorm(400,10.25,2)


# do the plot
plot(y=rep(6,length(y6)),x=y6,ylim=c(0,7),
  xlim=c(min(y1,y2,y3,y4,y5,y6),max(y1,y2,y3,y4,y5,y6)),
  type="n",xlab="",ylab="",yaxt="n")
stripchart(x=list(y1=y1,y2=y2,y3=y3),at=c(1,2,3),add=TRUE,pch=1)
vioplot(y4,y5,y6,at=c(4,5,6),add=TRUE,horizontal=TRUE)
axis(2,at=1:6,labels=c("y1","y2","y3","y4","y5","y6"))

enter image description here

share|improve this answer
    
Thank you so much, Glen_b! –  HueSX Apr 13 at 17:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.