Is there a way to output a stem and leaf plot to a graphical device, such as window()
/ quartz()
? There are at least two ways to get stem and leaf plots in R: ?stem, in the graphics package, and ?stem.leaf, in the aplpack package. Both output text to the console. For example:
> set.seed(1)
> stem(rbinom(10, size=10, prob=.5))
The decimal point is at the |
3 | 0
4 | 000
5 | 0
6 | 00
7 | 000
It would be nice if this could be conveniently output to a graphical device where it could be combined with other plots (say a histogram) in a multi-figure layout, and/or saved as a png file. I am aware that you can output LaTeX and compile it into a pdf (e.g., see: Stem and Leaf from R into LaTeX), but this isn't very convenient and isn't really what I'm after. Is there an R function that can do this? Is there a simple hand-coded solution?
See Question&Answers more detail:os