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

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

From |
annoporci <annoporci@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: level and distribution plot side by side |

Date |
Sun, 06 Jan 2013 02:46:54 +0800 |

Here is an example.

[ ...]

However, this example does not imply that I just wrote down these commands. No; this is the cleaned-up version after making numerous small changes. Open a do-file editor with a script once you have commands that work, expect to have to make many tweaks. -name(, replace)- is a crucial detail. Nick

This is stunning Nick, thanks a lot! It will come in very handy. I need to play with it at once.

I've adapted code from the Stata Manual, but it's not exactly right yet.

clear all webuse dow1,clear tsset t generate dayofwk = dow(date) list date dayofwk t ln_dow D.ln_dow in 1/8 list date dayofwk t ln_dow D.ln_dow in -8/l generate Dlndow = D.ln_dow #delimit ; twoway (tsline dowclose, yaxis(1) lcolor(blue)) (spike Dlndow date, yaxis(2) lcolor(cranberry)) , yscale(log axis(1) range(50 3000)) ylabel(500 1000 2000 3000, grid labsize(small) axis(1)) ytitle("Index", axis(1)) yline(250, axis(1) lstyle(foreground)) yscale(range(-.3 .3) axis(2)) ylabel(-.3 -.2 -.1 0 +.1, grid labsize(vsmall) axis(2)) ytitle("Returns", axis(2)) legend(off) title("DJIA, index and returns", margin(b+2.5)) note("2 Jan 1953 - 20 Feb 1990") graphregion(fcolor(none) margin(none)) plotregion(margin(none)) aspect(0.75) ; #delimit cr The output looks like this: http://www4.picturepush.com/photo/a/11882877/640/11882877.jpg

And another plot-related thing I've learned:

It is on Rense Corten's blog (comments off): http://www.rensecorten.dds.nl/index.php/2011/03/labeling-logarithmic-axes-in-stata-graphs/ It's similar to something you wrote on Statalist back in 2003: http://www.stata.com/statalist/archive/2003-11/msg00770.html I adapted it to make it a little more systematic, e.g. writing: forval x = `expmin'(`expstp')`expmax'{ instead of say forval x = 2(1)5{

Thanks Nick. -- Patrick Toche. Here is an example. sysuse sp500, clear histogram close, horizontal xsc(reverse) normal freq ysc(off) fxsize(20) name(g1, replace) width(10) line close date, ysc(alt) yla(, ang(h)) name(g2, replace) xla(, format(%tddd_Mon)) xtitle("2001") graph combine g1 g2, ycommon imargin(small) However, this example does not imply that I just wrote down these commands. No; this is the cleaned-up version after making numerous small changes. Open a do-file editor with a script once you have commands that work, expect to have to make many tweaks. -name(, replace)- is a crucial detail. Nick On Sat, Jan 5, 2013 at 10:37 AM, Nick Cox <njcoxstata@gmail.com> wrote:

See -help graph combine- and then the manual entry. In Stata terms, you combine using graphs from -twoway histogram- and -twoway line-. Nick Patrick Toche <annoporci@gmail.com> wrote:I saw this very nice graph: the main graph area has a twoway line ofsomevery spiky data, in a standard horizontal orientation; immediately nexttoit, on the left-hand side, is a frequency plot displayed sideways. Does anyone have sample code for this sort of display? many thanks. A picture speaks a thousand words: http://www5.picturepush.com/photo/a/11879063/640/11879063.jpg

* * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: level and distribution plot side by side***From:*Nick Cox <njcoxstata@gmail.com>

**References**:**st: generate the level series from the growth rate series***From:*annoporci <annoporci@gmail.com>

**st: level and distribution plot side by side***From:*annoporci <annoporci@gmail.com>

**Re: st: level and distribution plot side by side***From:*Nick Cox <njcoxstata@gmail.com>

**Re: st: level and distribution plot side by side***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**RE: st: Obtaining marginal effects and their standard errors after estimations with interactions** - Next by Date:
**Re: st: level and distribution plot side by side** - Previous by thread:
**Re: st: level and distribution plot side by side** - Next by thread:
**Re: st: level and distribution plot side by side** - Index(es):