Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Scott Merryman <scott.merryman@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Overlay multple axes' labels? |

Date |
Thu, 4 Mar 2010 14:43:38 -0600 |

Like this? sysuse sp500,clear gr twoway connected high date, yaxis(1) /// ysca(ra(500) axis(1)) /// || bar volume date, yaxis(2) /// ysca(alt ra(200000) axis(2)) /// ylab(0 10000, angle(horiz) grid labsize(small) axis(2)) ytitle("", axis(2)) /// || bar change date, yaxis(3) /// ysca(alt ra(-250 600) axis(3)) /// ylab(-50 0 50, angle(horiz) labsize(small) axis(3)) /// ytitle(Volume and closing price change, axis(3)) /// legend(off) gr_edit .move yaxis3 on 8 8 Scott On Thu, Mar 4, 2010 at 2:05 PM, Nick Winter <nwinter@virginia.edu> wrote: > Hi, > > I'm trying to make a single graph that combines three data series, which are > themselves on three different scales. I can get everything I want, except > for labeling the y-axes for plots 2 and 3. > > The following demonstrates the problem: I want the volume labels (0 and > 10,000) and the closing price change (-50, 0, and 50) to be on top of each > other, rather than having the latter on a separate axis to the right of the > former. > > > > * begin example > sysuse sp500 > > gr twoway connected high date, yaxis(1) /// > ysca(ra(500) axis(1)) /// > || bar volume date, yaxis(2) /// > ysca(alt ra(200000) axis(2)) /// > ylab(0 10000, angle(horiz) grid labsize(small) axis(2)) /// > || bar change date, yaxis(3) /// > ysca(alt ra(-250 600) axis(3)) /// > ylab(-50 0 50, angle(horiz) labsize(small) axis(3)) /// > legend(off) > * end example > > > Am I missing something obvious? > > I messed with creating the three plots separately and using -graph combine- > to put them together in a single column, but the different widths of the y > labels across the plots means that the x-axes don't line up with each other, > even with the -xcommon- option. > > Something like: > > > * begin second example > gr twoway connected high date, xsca(off) /// > graphregion(margin(b 0)) name(one, replace) > > gr twoway bar volume date, ysca(alt) xsca(off) /// > ylab(0 10000, angle(horiz) grid labsize(small)) /// > graphregion(margin(t 0 b 0)) /// > name(two, replace) > > gr twoway bar change date, ysca(alt) /// > ylab(-50 0 50, angle(horiz) labsize(small)) /// > graphregion(margin(t 0)) /// > name(three, replace) > > gr combine one two three, col(1) xcommon > * end second example > > > Any thoughts? > -- > -------------------------------------------------------------- > Nicholas Winter 434.924.6994 t > Assistant Professor 434.924.3359 f > Department of Politics nwinter@virginia.edu e > University of Virginia faculty.virginia.edu/nwinter w > S385 Gibson Hall, South Lawn Map: http://tinyurl.com/uvaSLmap > * > * 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/

**Follow-Ups**:**Re: st: Overlay multple axes' labels?***From:*Nick Winter <nwinter@virginia.edu>

**References**:**st: Overlay multple axes' labels?***From:*Nick Winter <nwinter@virginia.edu>

- Prev by Date:
**st: RE: How to get a list of the names of characters associated with a variable** - Next by Date:
**Re: st: RE: How to get a list of the names of characters associated with a variable** - Previous by thread:
**st: Overlay multple axes' labels?** - Next by thread:
**Re: st: Overlay multple axes' labels?** - Index(es):