Bookmark and Share

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


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

RE: st: Stacked histogram - empty bins


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
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. 

Nick 
[email protected] 

David Radwin

This topic of comparing distributions using multiple histograms has
appeared before, usually in the form of showing overlapping histograms.
See, e.g., http://www.stata.com/statalist/archive/2008-09/msg01336.html ,
http://www.stata.com/statalist/archive/2003-05/msg00653.html, or a couple
of examples on http://www.survey-design.com.au/Stata%20Graphs.html . 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:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index