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

From |
"Rajesh Tharyan" <R.Tharyan@exeter.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: overlapping histograms |

Date |
Mon, 29 Sep 2008 21:58:07 +0100 |

Hi, Could this be a job for the bihistogram? There was a discussion on this list earlier. Austin Nichols did post a code to create one. hth Rajesh -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox Sent: 29 September 2008 21:02 To: statalist@hsphsun2.harvard.edu Subject: Re: st: overlapping histograms Do you mean something like this? sysuse auto twoway histogram mpg if foreign, start(10) width(2) bfcolor(none) blcolor(red) || histogram mpg if !foreign, start(10) width(2) bfcolor(none) blcolor(navy) barw(1.9) legend(off) Jeph Herrin wrote: > > Yes, a colleague specifically wants histograms, and he knows > his audience, presumably. More pointedly, he also has a > figure just like he wants, from an unknown source, which is > clearly created in Stata. However, the solution there is to > narrow the bars in the top histogram, while leaving those in > the back full width. This works well visually - the eye is > tricked into seeing both distributions at once, despite a great > deal of overlap, except I'm not happy that the bars are not > the same width. So I'm trying to improve on it, while sticking > close to what it is. > > Thanks to others for their suggestions. > > cheers, > Jeph > > > > > > Nick Cox wrote: >> Jeph may be acting under orders, i.e. someone is insisting on >> something like this, but the problem that one obscures the other >> presumably arises because your distributions are not too different and >> is likely to persist with any small modifications to the recipe. >> >> In addition to other solutions suggested, -qqplot-, -qplot- (SJ), >> -distplot- (SJ), -stripplot- (SSC), -beamplot- (SSC) are some commands >> I would use to compare distributions graphically long before I tried >> to superimpose histograms. >> >> Nick >> n.j.cox@durham.ac.uk >> >> Jeph Herrin wrote: >>> >>> I've been trying to create a graph which shows >>> two overlapping histograms - I'm trying to show >>> how the distribution for a quantity if interest >>> has shifted from time A to time B. >>> >>> Putting two histograms on one graph is not the >>> problem >>> >>> twoway (histogram myvarA) (histogram myvarB) >>> >>> >>> but the problem is that one obscures the other. I >>> can make the one on top "clear" (specify -color(none)-) >>> but because the bars line up it still difficult to >>> distinguish them. So I'm looking for a way to do >>> either >>> >>> 1. make the overlapping areas a darker color than >>> either histogram is alone >>> 2. shift the bars for one histogram so that the one >>> behind can be seen ever so slightly >>> >>> Is there a way to do either? Is there a better solution? >> >> * >> * 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/ >> > * > * 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/ > * * 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/ * * 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/

**References**:**st: overlapping histograms***From:*Jeph Herrin <junk@spandrel.net>

**Re: st: overlapping histograms***From:*Nick Cox <n.j.cox@stata.com>

**Re: st: overlapping histograms***From:*Jeph Herrin <junk@spandrel.net>

**Re: st: overlapping histograms***From:*Nick Cox <n.j.cox@stata.com>

- Prev by Date:
**Re: st: overlapping histograms** - Next by Date:
**Re: st: RE: analogues of macros in Mata?** - Previous by thread:
**Re: st: overlapping histograms** - Next by thread:
**Re: st: overlapping histograms** - Index(es):

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