Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: graph combine

From   Ramani Gunatilaka <>
Subject   Re: st: graph combine
Date   Wed, 05 Nov 2003 05:43:40 +0000

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
sleep 3000

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
sleep 3000

gr combine Lorenz.gph Lordiff.gph, col(1) 
log close

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)" <> wrote:
> In stata 8, when combining multiple graphs that have the same legend is
> it
> possible to have only one legend included on the combined graph. Thanks,
> Steve
> <><><><><><><><><><><><><><><><><><><>
> Steven Stillman - Senior Research Economist
> Labour Market Policy Group - Department of Labour
> PO Box 3705 - Wellington, New Zealand
> Email:     
> Web:
> <> 
> 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:
> *
> *
> *
*   For searches and help try:

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