Here is a question for R-users. I am interested in drawing a histogram with points stacked up, instead of a bar. For example if the data is (1,1,2,1,2,3,3,3,4,4), then I would like to see three points stacked up at 1, 2 points stacked up at 2 and so on. What is the best way to do this in R?
+2
A:
Greg Snow's TeachingDemos package contains a dots(x, ...) method which seems to fit your need: http://bm2.genes.nig.ac.jp/RGM2/R%5Fcurrent/library/TeachingDemos/man/dots.html
Sol C.
2009-12-20 04:44:37
Seems to be the simplest of all solutions!! Thanks Kyubic
Ramnath
2009-12-20 13:44:26
+1
A:
You can do this yourself pretty quickly:
x <- c(1,1,2,1,2,3,3,3,4,4)
plot(sort(x), sequence(table(x)))
Jonathan Chang
2009-12-20 05:40:36
+1
A:
The simplest answer I know is this:
x <- c(1,1,2,1,2,3,3,3,4,4)
stripchart(x,method="stack",at=0)
It's better than Jonathan Chang's suggestion because stripchart
does proper stacking of points.
Rob Hyndman
2009-12-20 09:04:59
Thanks Rob. Stripchart seems very intuitive, although I would prefer the stack of points to be separate.
Ramnath
2009-12-20 13:42:52