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, statalist.org is already up and running.


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

st: RE: Combining histograms


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Combining histograms
Date   Fri, 20 May 2011 19:50:39 +0100

"combine", "merge" both admit of different interpretations. 

You can use -graph combine-. You don't say what you typed or in what sense you "didn't manage to get the result".  

Otherwise I'll guess that you want to superimpose histograms. 

You can do that in various ways. Often it's hard work to stop bars of one variable occluding bars of the other variable. 

sysuse auto, clear

twoway histogram trunk, width(2) start(0) bfcolor(none) blcolor(blue) freq  
|| histogram mpg, width(2) start(0) bfcolor(none) blcolor(red) barw(1.7) freq legend(order(1 "`: var label trunk'" 2 "`: var label mpg'"))

This is a 19th century way of comparing distributions. -qqplot- gives you a 20th century method with no binning choices or artefacts. 

Nick 
n.j.cox@durham.ac.uk 

Michael Hecker

I create two histograms using:

hist X, saving(normal, replace)
hist Y, saving(changed, replace)

Is it possible two merge both gph-files into a single graph?
I didn't manage to get the result with "graph combine".
I want to have both histograms in a single chart to compare the 
distributions.


*
*   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   |   Site index