Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: RE: Putting a rug underneath a boxplot

 From Nick Cox To "'statalist@hsphsun2.harvard.edu'" Subject st: RE: Putting a rug underneath a boxplot Date Thu, 14 Oct 2010 17:51:22 +0100

```Basically you are in a cul-de-sac.

You need to retreat and knit your own using -twoway-.

See for example

SJ-9-3  gr0039  . . . . . . . . Speaking Stata: Creating and varying box plots
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
Q3/09   SJ 9(3):478--496                                 (no commands)
explains how to use egen to calculate the statistical
ingredients needed for box plots and variations of box
plots; shows the use of twoway to then create the plots

or see -stripplot- from SSC:

sysuse auto, clear
gen pipe = "|"
stripplot price, over(rep78) box(barw(0.3)) ms(none) mla(pipe) boffset(0.3)

Nick
n.j.cox@durham.ac.uk

Oliver Jones

the task is to create a boxplot with a rug underneath it.
My first attempt was to do something like this:

************************* begin example *************************
sysuse auto, clear

graph hbox price, ///
ylab(minmax,nogrid) yscale(off) ///
graphregion(icol(white) col(white)) ///
nodraw name(boxplot, replace)
gr_edit .varaxis.draw_view.setstyle, style(no)

gen byte y_value = 1
tw spike y_value price, ///
fysize(20) xlab(minmax) yscale(off) ylab(0(1)1, nogrid) ///
graphregion(icol(white) col(white)) ///
nodraw name(rug_plot, replace)

graph combine boxplot rug_plot, ///
ysize(3) iscale(1) ///
graphregion(icol(white) col(white)) ///
rows(2) imargin(b=0 t=0) name(gcom1, replace)

************************* end example *************************

Two thing still give me trouble:

First:
The gap between the boxplot and the rug is too big.

Second:
When -graph combine- ing 10 of these "box-rug-plot"
the rug is so huge that the boxplots are not visible anymore.

I allready had a look at "Speaking Stata: Graphing distributions" N.J. Cox (2004) in The Stata
Journal Issue 4 Number 1 pp.66-88, but the way he puts a rug underneath a histogram is not
possible for a boxplot, or is it and I just don't know how to do it?

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```