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]

RE: st: Stacked histogram - empty bins

From   Nick Cox <>
To   "''" <>
Subject   RE: st: Stacked histogram - empty bins
Date   Fri, 29 Jul 2011 17:26:15 +0100

Downtown or Manhattan skyline plots are a few lines to get going:

. twoway__histogram_gen mpg if foreign, gen(f_foreign f_mpg) start(10) width(2)

. twoway__histogram_gen mpg if !foreign, gen(f_domestic g_mpg) start(10) width(2)

. line f_foreign f_mpg, c(J) || line f_domestic g_mpg, c(J)

-- but the result needs more work to be made presentable and I dislike them with a passion, so sorry, no .ado from me. 


David Radwin

This topic of comparing distributions using multiple histograms has
appeared before, usually in the form of showing overlapping histograms.
See, e.g., ,, or a couple
of examples on . There
are also numerous cautions against using histograms at all and ideas (like
Nick Cox's earlier suggestions) for alternative graph types.

I have occasionally wished for a "line histogram" that would just show a
line for the top and sides of each histogram without the other lines
defining each bar, similar in appearance to Stata's -kdensity- but with
right angles only (approximately like -kdensity- with the option
-kernel(rectangular)-). If I were a better programmer, I would write such
a program myself.

In the meantime, one more suggestion (but not quite what you want) is
Austin Nichols's -bihist- or -byhist-, both available from SSC.

*   For searches and help try:

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