Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Putting a rug underneath a boxplot

From   Oliver Jones <>
Subject   st: Putting a rug underneath a boxplot
Date   Thu, 14 Oct 2010 18:27:26 +0200

Hi Statalist,
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:

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

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?

Kind regards
Universität Bielefeld
Fakultät für Wirtschaftswissenschaften
Lehrstuhl für Ökonometrie und Statistik
- - -
Bielefeld University
Faculty of Business Administration and Economics
Chair of Econometrics and Statistics
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index