Bookmark and Share

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

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

st: How to determine label order in sts graph (legend)?

From   Tim Evans <>
To   "''" <>
Subject   st: How to determine label order in sts graph (legend)?
Date   Tue, 29 Jan 2013 13:05:34 +0000

Hi all,

I producing Kaplan-Maier curves in Stata 11.2 and always struggle when trying to identify and control the different curves and thus their underlying ordering in the legend of the graph.

For instance, I use the code below to generate my graph. There are 2 routes of presentation, male and female as well as CIs which should I think give 8 different legend potential entries. I end up spending vast amounts of time guessing at the label values and appropriate titles in the legend option (this will probably carry through to the atrisk table as well). Does anyone know how I can easily produce a numbered list so that I can identify the label number for each variable I am cutting my analysis by so that I can stop the guessing? If for instance I remove gender from the -by- option, I don’t want to have to guess the orderings again - if I can print a list that is.

sts graph if yydx>2006, by(epi_type2 gender) ci tmax(5) subtitle("") title("Presentation route by gender (with 95% confidence intervals)", size(small))/*
	*/ legend(region(lstyle(none)) rows(1) size(small) lcolor(none) /*
	*/ forcesize symxsize(8) keygap(4) symysize(small))/*
	*/ xtitle("Years from diagnosis", size(small)) /*
	*/ legend(label(12 "Screen detected - Females") label(11 "Screen detected - Males") order(12 11))  /*
	*/ risktable(, size(small) title("No. at risk", size (small)) order(12 "Screen detected - Females" 11 "Screen detected - Males" ) rowtitle(, justification(left))) /*
	*/ ytitle("Proportion surviving", size(small)) /*
	*/ ylabel(0 "0%" 0.25 "25%" 0.5 "50%" 0.75 "75%" 1 "100%", angle(horizontal) labsize(small)) plotregion(lstyle(none)) /*
	*/ xlab(, labsize(small))	

Any help appreciated
Best wishes

This email and any attachments hereto contains proprietary information, some or all of which may be confidential or legally privileged. It is for the exclusive use of the intended recipient(s) only. If an addressing or transmission error has misdirected this e-mail and you are not the intended recipient(s), please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail or any attachments, as this may be unlawful.

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index