[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: graph combine
Others may have more efficient ways of doing this, but for whatever it's worth, here's my solution.
Define the first graph without a legend, that is legend(off).
Define the second graph with a legend (default or define it as you like in terms of position, etc).
Next combine the two.
What follows is a piece of code to graph Lorenze curves and transformed Lorenz curves and then combine the two in one graph. Note that the x axis is common to both.
twoway line cumx95 cumx90 cumx85 cumpop cumpop, ylabel(0(0.2)1.0) ytitle( "Cumulative Share of Expenditure") xlabel(0(0.2)1.0) xtitle( "Cumulative Share of Population" ) title( "Lorenz Curves, 1985-96") leg(off) clpattern(shortdash_dot dash solid)
graph save Lorenz, replace
twoway line comp95 comp90 comp85 cumpop, ylabel(0(0.1)0.35) ytitle( "Line of Equality - Cumulative Consumption Share" )xlabel(0(0.2)1.0) xtitle( "Cumulative Share of Population" )title( "Transformed Lorenz Curves, 1985-96") leg(rows(1))clpattern(shortdash_dot dash solid)
graph save Lordiff, replace
gr combine Lorenz.gph Lordiff.gph, col(1)
Even though I did this, I found the resulting combined graph's y axes were too short relative to the x axes. I couldn't figure out how to fix this. If you have any ideas, I would appreciate them.
I hope this helps.
"Steven Stillman (LMPG)" <Steven.Stillman@lmpg.dol.govt.nz> wrote:
> In stata 8, when combining multiple graphs that have the same legend is
> possible to have only one legend included on the combined graph. Thanks,
> Steven Stillman - Senior Research Economist
> Labour Market Policy Group - Department of Labour
> PO Box 3705 - Wellington, New Zealand
> Email: email@example.com
> Web: http://www.thestillmans.org/econ.html
> Tel: (64)4-915-4076 - Fax: (64)4-915-4040
> The information contained in this document is intended only for the
> addressee and is not necessarily the views nor the official
> communication of the Department of Labour. All final/official papers
> which are sent from the Department will be sent by non-electronic
> means, on appropriate letterhead, signed by authorised personnel.
> * For searches and help try:
> * http://www.stata.com/support/faqs/res/findit.html
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
* For searches and help try: