Bookmark and Share

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

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

Re: st: RE: Combining histograms

From   Michael Hecker <>
Subject   Re: st: RE: Combining histograms
Date   Sat, 21 May 2011 00:39:54 +0200

Deal Nick,
thank you very much. This looks like a very good starting point.


Am 20.05.2011 20:50, schrieb Nick Cox:
"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.


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

*   For searches and help try:

*   For searches and help try:

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