Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Joerg Luedicke <joerg.luedicke@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: xtline with legend on variables lines |
Date | Sat, 30 Mar 2013 22:04:58 -0400 |
See -help added_text_options-. For example: xtline rinc2001, overlay /// graphregion(fcolor(white)) /// ytitle(Income in Pesos of 2001) /// xtitle(Years in the labor force) /// graphregion(fcolor(white) /// lcolor(white) /// ifcolor(white) /// ilcolor(white)) /// text(235000 3 "Cohort = 1998") /// text(280000 10.5 "Cohort = 1993") /// text(250000 14 "Cohort = 1988") /// legend(off) Joerg On Sat, Mar 30, 2013 at 1:14 PM, Fernando Luco <flucoestatalist@gmail.com> wrote: > Hi, > > I'm trying to make a plot with income for different cohorts, by number > of years in the labor force. Because I have many cohorts I would like > to forget about putting the legend in a box and instead I would like > to put, at the side of each line, to which cohort the line belongs. Is > there any way to do this? Please note that for each cohort, by > construction the final observation is to the left of the one of the > previous cohort because later cohorts have been in the labor force for > less time. I would like the "legend" to respect this so for each > cohort the legend should be at the end of the line of that cohort. > > A sample of my data is the following > > clear > input cohort rinc2001 year_labor_force > 1988 90973.04 1 > 1988 109293.6 2 > 1988 124790.5 3 > 1988 138180.7 4 > 1988 156250.7 5 > 1988 169836.4 6 > 1988 185182.2 7 > 1988 199551 8 > 1988 218024.7 9 > 1988 233200.8 10 > 1988 252241.5 11 > 1988 257812.3 12 > 1988 261181.8 13 > 1988 267360.2 14 > 1993 168125.5 1 > 1993 158848.3 2 > 1993 181543.5 3 > 1993 202664.4 4 > 1993 223277.6 5 > 1993 250046.7 6 > 1993 262088 7 > 1993 272222.7 8 > 1993 278854.8 9 > 1998 250805 1 > 1998 203676.8 2 > 1998 221521 3 > 1998 227699.4 4 > end > tsset cohort year_labor_force > xtline rinc2001, overlay graphregion(fcolor(white)) ytitle(Income in > Pesos of 2001)/* > */ xtitle(Years in the labor force) graphregion(fcolor(white) > lcolor(white) ifcolor(white) ilcolor(white)) > > Thanks, > > Fernando > * > * 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/