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]

st: RE: Combining histograms


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

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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index