I have generated a KM plot for 2 groups, with 95% CIs.
The default legend gives 4 keys (line for each group, and shaded key to highlight 95% CI), as below code/plot.
For presentation cleanliness I am trying to remove the 95% CI keys as they add little (and will be described in caption).
However, the problem arises that after doing this, the 'lines' for each key of the groups revert to the colour of the shaded 95% CI region, rather than the line colour/style of the treatment groups, with code/plot below.
I have tried multiple strategies (the above is just 1 version) of changing labels/colours/lines/order of legend, and none of them have succeeded.
When using graph editor, there is a suspicious behaviour that I can change the line in the key, but this then changes the boundaries of the 95% CI intervals of the actual graph.
Is this manipulation of keys possible in Stata 15?
The default legend gives 4 keys (line for each group, and shaded key to highlight 95% CI), as below code/plot.
Code:
sts graph, by(treatmentgroup) /// title("Kaplan-Meier survival curves by treatment group", size(medium)) /// graphregion(color(white)) /// ylabel(0(0.2)1, angle(0)) /// ytitle("Survival probability") /// xlabel(0(2.5)20) /// xtitle("Months") /// plot1opts(lpattern(dash)) /// plot2opts(lpattern(solid)) /// ci
However, the problem arises that after doing this, the 'lines' for each key of the groups revert to the colour of the shaded 95% CI region, rather than the line colour/style of the treatment groups, with code/plot below.
Code:
sts graph, by(treatmentgroup) /// title("Kaplan-Meier survival curves by treatment group", size(medium)) /// graphregion(color(white)) /// ylabel(0(0.2)1, angle(0)) /// ytitle("Survival probability") /// xlabel(0(2.5)20) /// xtitle("Months") /// plot1opts(lpattern(dash)) /// plot2opts(lpattern(solid)) /// legend( /// col(1) size(small) ring(0) pos(2) /// order(2 "Group A" 4 "Group B") /// label(2 "Group A" lcolor(blue) lpattern(dash)) /// label(4 "Group B" lcolor(red) lpattern(solid))) /// ci
I have tried multiple strategies (the above is just 1 version) of changing labels/colours/lines/order of legend, and none of them have succeeded.
When using graph editor, there is a suspicious behaviour that I can change the line in the key, but this then changes the boundaries of the 95% CI intervals of the actual graph.
Is this manipulation of keys possible in Stata 15?
Comment