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

# Re: st: Plotting normal distributions

 From Nick Cox To statalist@hsphsun2.harvard.edu Subject Re: st: Plotting normal distributions Date Thu, 7 Jun 2012 10:34:56 +0100

```There are ways of overlaying histograms, but for 19? Your chances are
that some will occlude others at least in part and how could it be
otherwise?

As an example showing technique only

sysuse auto, clear

twoway histogram mpg if foreign, start(12) width(2) barw(1.9)
bfcolor(none) blcolor(red)  ///
|| histogram mpg if !foreign, start(12) width(2)  bfcolor(none)
blcolor(blue) ///
legend(order(1 "Foreign" 2 "Domestic") pos(3) col(1))

Nick

On Thu, Jun 7, 2012 at 10:20 AM, Amal Khanolkar <Amal.Khanolkar@ki.se> wrote:
> 1. Yes, I have 19 such distributions which are approx. normal.
>
> 2. I would like to compare them to the reference country.
>
> Does one use 'histogram' for the above then? Wasn't able to find how I can overlay them in the same graph.
>
> I agree, having 19 distributions on top of each will not be very informative. One idea could be to plot them in groups of about 4-5 countries which group having the reference country as well for comparison.
>
>
> Thanks for your tip - I will try that as well.
>
> Thanks,
> ________________________________________
> From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] on behalf of Nick Cox [njcoxstata@gmail.com]
> Sent: 07 June 2012 11:15
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: Plotting normal distributions
>
> Does this mean
>
> 1. You have distributions, which happen to be approximately normal,
> and you want to plot their distributions on top of each other.
>
> 2. You have distributions and you want to compare them with normal
> distributions with specified means and standard deviations.
>
> ?
>
> Either way, 19 distributions on top of each other is just a recipe for
> a mess. I advise against.
>
> More positively, if the distributions really are normal, then they are
> characterised by their means and standard deviations and a labelled
> scatter plot of sd versus mean is likely to be much more interesting
> and informative than a spaghetti version of multiple histograms.
>
> Nick
>
> On Thu, Jun 7, 2012 at 10:02 AM, Amal Khanolkar <Amal.Khanolkar@ki.se> wrote:
>
>> I would like to plot normal distributions of birth weight by nationality in the same graph for comparison, using different colours.
>>
>> I wasn't able to figure out how to do this. What I've managed so far is to plot each birth weight distribution separately in small graphs and get it together as one image using the basic histogram command:
>>
>> hist BW, by (motherland)
>>
>> I have 19 nationalities. Not sure how many different colours Stata permits  - but maybe a combination of colours and schemes (liked dashed lines) is needed?

*
*   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/
```