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

Re: st: overlapping histograms

From   Svend Juul <SJ@SOCI.AU.DK>
To   <>
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)) ///

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


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 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

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index