Graph Sample Code
est use "$estimates/margins_majcomp_model1" ** Regular Look: set scheme s1mono ** Define gls #delimit ; gl graph_globals operation graph1 ti subti xti yti note caption txtbox1 txtbox2 nickname ; #delimit cr foreach x in $graph_globals{ macro drop `x' } gl operation all_cardiac gl graph1 *gl ti "Risk-Adjusted Rate of Major Complications, 2000-2008" gl subti *gl xti "Year of Index Operation" *gl yti "Major Complications (%)" gl note gl caption gl txtbox1 gl txtbox2 gl nickname majcomp_model1 ** Graph code #delimit ; marginsplot , // Names and titles name($nickname, replace) title("$ti", size(medlarge) margin(medium)) subtitle("$subti") xtitle("$xti", color(black) margin(medlarge) size(med) ) ytitle("$yti", color(black) margin(small) size(med)) note("$note", color(black) margin(zero)) caption("$caption") // Marker options plotopts( mlabel() msize(vsmall) mcolor() mlcolor() msymbol() ) // plot regions plotregion( lcolor(white) ) // Axis options xsize(7) ysize(5) xscale( lcolor(black) lw(medthick)) yscale( lcolor(black) lw(medthick)) xlabel(,labcolor(black) labs(medlarge)) ylabel(0 "0" .05 "5" .1 "10" .15 "15" .2 "20" .25 "25" .3 "30" ,labcolor(black) labs(medlarge)) ; #delimit cr /* // text box 1 text(0 0 "$txtbox1" , place(se) box just(left) margin(l+1 t+1 b+1) size(vsmall) ) // text box 2 text(0 2600 "$txtbox2" , place(se) box just(left) margin(l+1 t+1 b+1) size(vsmall) ) */ ** Saving and exporting graph save "$graph/($operation) $nickname", replace * graph use "$graph/($operation) $nickname.gph" graph export "$graph/($operation) $nickname.png", replace // for tumblr graph export "$graph/($operation) $nickname.pdf", replace * graph export "$graph/($operation) $nickname.eps", replace fontface(calibri) ** Drop Graph Globals display "$yti" foreach x in $graph_globals{ macro drop `x' } display "$yti"












