Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: overlapping histograms


From   Svend Juul <SJ@SOCI.AU.DK>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: overlapping histograms
Date   Tue, 30 Sep 2008 10:52:29 +0200

Jeph wrote - in a comment to several suggestions:

More like this:

sysuse auto

twoway ///
(histogram mpg if foreign, bin(10) gap(5) fc(gray) lc(black)) ///
(histogram mpg if !foreign, bin(10) gap(15) fc(white) lc(black)) ///
   legend(off)

It works better when there are more bins, ie, more obs - I have 100k
obs so I have lots of thin bars. The effect is quite good, though
I dislike that, as here, one distribution has thinner bars than the
other.

================================================================

Fascinating game. How about this?

twoway ///
(histogram mpg if !foreign, start(10) width(2) fc(white) lc(black)) ///
(histogram mpg if foreign, gap(50) fc(gray) lc(black) start(10)
width(2)) ///
   , legend(off) plotregion(margin(b=0))

Svend
__________________________________________

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000  Aarhus C, Denmark
Phone:  +45 8942 6090
Home:   +45 8693 7796
Email:  sj@soci.au.dk
__________________________________________ 

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index