Philippe underestimates his own program!
One of the small problems here is that -glcurve-
internally uses -legend(order())-, but to
overwrite that you just need to use the
same. At the same time you can label
the extra diagonal and fix the line patterns.
sysuse auto, clear
glcurve mpg, by(foreign) split lorenz
plot(function equality = x)
legend(order(1 "Domestic" 2 "Foreign" 3 "equality")) clp(dot dash solid)
Nick
[email protected]
Anna Gueorguieva
> Thank you so much for your prompt response.
> Worked excellent, with the only corrections :
> lpattern(solid dash "._") to
> clpattern(solid dash "._")
> and
> lwidth(medthick) to
> clwidth(medthick)
Philippe van Kerm
> You are right, -glcurve- uses it's own legend and does
> not seem to pay
> attention to the legend you supply. Anyway, if you
> want to produce
> 'publication quality' pictures and need maximum
> control over your plots,
> you will be better off splitting the estimation step
> and the plotting
> step: (i) use -glcurve- and save the coordinates in
> new variables, then
> (ii) use -twoway- to produce the final plot. For
> example,
>
> sysuse auto, clear
> rename price hhsub
> drop if rep78==5
> rename rep78 level2
>
> // estimate and save coordinates in new variables
> glcurve hhsub [aw=weight] if level2~=.&level2~=1, ///
> lorenz by(level2) glvar(gl) split pvar(p) nogr
>
> // plot results (notice the lpattern() option for
> changing the pattern -
> your last question)
> tw line gl* p , lpattern(solid dash "._") sort ///
> || function equality=x , lwidth(medthick) ///
> legend(label(1 "Secondary") label(2 "VET") label(3
> "Tertiary")
> label(4 "Perfect equality")) ///
> xtitle("Cumulative share of population") ///
> ytitle("Cumulative share of benefits") ///
> title("Equity in Educational Public Subsidies") ///
> subtitle("Albania, 2005") ///
> subtitle("Lorenz curve") ///
> note("Source: LSMS 2005.")
Anna Gueorguieva
> > any suggestions how to get the labels right?
> > Currently, the graph shows "hhsub[2]" in the legend
> > rather than the label I want. Also, how do I label
> > the
> > equity line? How do I make the lines dotted or
> > dashed
> > (rather than different colors)?
> > Stata8 SE user.
> >
> > glcurve hhsub [aw=weight] if level2~=.&level2~=1,
> > lorenz by(level2) split plot(function equality=x)
> > legend(label(1 "Secondary") label(2 "VET") label(3
> > "Tertiary"))
> > xtitle("Cumulative share of population")
> > ytitle("Cumulative share of benefits")
> > title("Equity in Educational Public Subsidies")
> > subtitle("Albania, 2005")
> > subtitle("Lorenz curve")
> > note("Source: LSMS 2005.");
*
* 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/