 |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: combining two Kaplan Meier graphs, with only one legend
Hello,
I'm seeking advice on how to combine two Kaplan Meier graphs, with
only one legend. Using the hip2.dta dataset, I've created one KM
graph where calcium is <10, and one where calcium is >10. I'd
appreciate any suggestions on how to show:
(a) on each sub-graph:
the sub-titles
"Calcium<10"
"Calcium>=10"
the x-label "Survival time in months"
(b) on the combined graph only:
the legend " ___ Protected" and "---- Not protected"
a main title "Benefit of Protection Based on Calcium Level"
****** begin example *******
use hip2.dta, clear
* KM compare protect = yes to protect = no, where Calcium<10
sts graph if calcium<10, by(protect) title("Calcium<10", box
bfcolor(white)) ///
saving("cal<10", replace ) legend(label(1 "Protected")
label(2 "Not Protected")) ///
lpattern(l - dot _) lcolor(black black black black)
xtitle("Survival time in months") l2title("Percent surviving")
xmtick(0(10)40)
* KM compare protect = yes to protect = no, where Calcium>=10
sts graph if calcium>=10, by(protect) title("Calcium>=10", box
bfcolor(white)) ///
saving("cal>=10", replace ) legend(label(1 "Protected")
label(2 "Not Protected")) ///
lpattern(l - dot _) lcolor(black black black black)
xtitle("Survival time in months") l2title("Percent surviving")
xmtick(0(10)40)
* FIGURE 1: KM, all stages by stage, combined into one graph
graph combine cal<10.gph cal>=10.gph, saving("all_cal", replace )
rows(2) cols(2) iscale(0.5)
****** end example *******
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/