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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

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

Subject |
st: AW: RE: bar graph with 2 y-axes |

Date |
Mon, 27 Apr 2009 15:19:48 +0200 |

<> I was searching for an option to -jitter- (which some Stata -graph-s do allow), but did not know you could introduce it through the back door :-) HTH Martin -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Nick Cox Gesendet: Montag, 27. April 2009 15:16 An: statalist@hsphsun2.harvard.edu Betreff: st: RE: bar graph with 2 y-axes One way to proceed is splendidly ad hoc. use http://www.stata-press.com/data/r10/friedman2.dta gen year = yofd(dofq(time)) collapse m1 consump , by(year) gen year1 = year - 0.2 gen year2 = year + 0.2 twoway bar consump year1, barw(0.4) || bar m1 year2, barw(0.4) (In this example, no doubt there is a case for a different kind of -collapse-, but it doesn't affect the graphical issue.) Such age-old trickery was written up in SJ-7-1 gr0026 . . . . Stata tip 42: The overlay problem: Offset for clarity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . J. Cui Q1/07 SJ 7(1):141--142 (no commands) tip for graphing several quantities on a continuous axis Nick n.j.cox@durham.ac.uk Jochen Späth After screening the statalist and some graphical advice literature in the last days I still haven't got the clue: I need to draw a bar graph for two time series with different scales (e.g. one in millions, the other in billions) over years. Graph bar delivers the desired over-all look as, f.i., in -graph bar var1 var2, over(year)-. But I would like to have two different scales (left and right). -graph bar- does not offer such an option with the -over-option - logically. In -twoway bar-, which has the option for a second vertical axis as in -graph twoway (bar var1 year, yscale(1)) (bar var2 year, yscale(2))-, I have not managed to override the default result that the bars are drawn one behind the other - I rather want them one beside the other (and grouped over years). * * 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: bar graph with 2 y-axes***From:*Jochen Späth <jochen.spaeth@iaw.edu>

**st: RE: bar graph with 2 y-axes***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

- Prev by Date:
**st: AW: RE: bar graph with 2 y-axes** - Next by Date:
**Re: st: Question on a meta-regression problem** - Previous by thread:
**st: AW: RE: bar graph with 2 y-axes** - Next by thread:
**Re: st: Question on a meta-regression problem** - Index(es):

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