Hi there
I would like to add e.g. a cross or a filled cirkle at the end of some of the bars in the hbar graph to indicate that the individual person has died (var died: yes=1, no=0).
I have great difficulties finding the solution/ command for this. Anyone who knows how to do it?
I have created an example to visualize similar data:
use http://www.stata-press.com/data/r14/diet, clear
rename dob date_first_diagnosis
label var date_first_diagnosis date
rename doe date_second_diagnosis
label var date_second_diagnosis date
rename dox date_end
label var date_end date
rename hienergy died
label var died "died yes=1 no=0"
keep id died date_first_diagnosis date_second_diagnosis date_end
gen time1= date_second_diagnosis-date_first_diagnosis
gen time2= date_end-date_second_diagnosis
drop if id>50
generate total= time1+time2
graph hbar (asis) time1 time2, legend(off) ///
over(id, gap(*.9) label(labsize(*0.6)) sort(total) descending) stack nofill ///
ytitle("Days") ///
ylabel ("5000 10000 15000 20000 25000 30000") ///
ysize(7)
I would like to add e.g. a cross or a filled cirkle at the end of some of the bars in the hbar graph to indicate that the individual person has died (var died: yes=1, no=0).
I have great difficulties finding the solution/ command for this. Anyone who knows how to do it?
I have created an example to visualize similar data:
use http://www.stata-press.com/data/r14/diet, clear
rename dob date_first_diagnosis
label var date_first_diagnosis date
rename doe date_second_diagnosis
label var date_second_diagnosis date
rename dox date_end
label var date_end date
rename hienergy died
label var died "died yes=1 no=0"
keep id died date_first_diagnosis date_second_diagnosis date_end
gen time1= date_second_diagnosis-date_first_diagnosis
gen time2= date_end-date_second_diagnosis
drop if id>50
generate total= time1+time2
graph hbar (asis) time1 time2, legend(off) ///
over(id, gap(*.9) label(labsize(*0.6)) sort(total) descending) stack nofill ///
ytitle("Days") ///
ylabel ("5000 10000 15000 20000 25000 30000") ///
ysize(7)
Comment