Dear Statalist users,

I am creating a graph where I display recurrent event times over a period of 17 years. I am looking at two different events (CT and NT) within the same graph.

As I have my coding now, I am only able to label subjects by number, but I would like to be more specific and use words. In total I have 12 subjects (6 for CT, and 6 for NT). Instead of labeling them 1 to 12, I would like to label them as 1.NT, 2.NT, 3.NT, 4.NT, 5.NT, 6.NT 1.CT, 2.CT, 3.CT, 4.CT, 5.CT, 6.CT. while keeping their current order.

My coding is currently as follows:

twoway(line id time, connect(L)) (scatter id time if event==1, msymbol(t) mcolor(maroon)) (scatter id time if event==2, msymbol(s) mcolor(maroon)) (scatter id time if t_end==18, mcolor(maroon) msymbol(Oh)), ylabel(1 2 3 4 5 6 7 8 9 10 11 12) legend(label(1 time under risk) label(2 uptake event NT) label(3 uptake event CT) label(4 right censoring)) xtitle("time (in years)") ytitle("subjects") title("Schematic plot for recurrent time-to-event data") xlabel(0(1)18)
My graph currently looks as follows:

Array


I am unsure how to modify my coding to achieve this. Any help would me much appreciated.

Jesus P.