Search code examples
plotstatasurvival-analysis

How can I modify the plot format of stcurve?


My code is as follows:

    use http://www.ats.ucla.edu/stat/data/uis.dta, clear
    stset time, failure(censor)
    streg , dist(weibull) 
    stcurve, hazard

I am looking for a way to personalize the format of output plot in stcurve. For instance, how can I change the light blue background color, labels, font size, and heading of the plot?


Solution

  • You can first look in help stcurve: there is a link to help twoway_options All is there.

    For the font, see the Stata manual here.

    Here an example for what you've asked:

    use http://www.ats.ucla.edu/stat/data/uis.dta, clear
    stset time, failure(censor)
    streg , dist(weibull) 
    
    graph set window fontface "Times New Roman"
    #delimit ;
    stcurve, hazard
    title("new title")
    graphregion(color(white) icolor(white))
    plotregion(color(white) icolor(white))
    ytitle( "Y title",size(3.5)) 
    xtitle( "X title",size(3.5)) ;
    #delimit cr