Combining two plots into one figure and
export it as a Windows Meta File
that can be inserted in a Word doccument.
use bmiwomen.dta,clear
histogram bmi, norm name(p1)
qnorm bmi, name(p2)
graph combine p1 p2, name(Figure1_2)
graph drop p1 p2
graph export Figure1_2.wmf,replace
Combining five QQ-plots (see also advanced below)
use trigly.dta, clear
qnorm trigly if sample==1, name(p1) ytitle(Sample 1)
qnorm trigly if sample==2, name(p2) ytitle(Sample 2)
qnorm trigly if sample==3, name(p3) ytitle(Sample 3)
qnorm trigly if sample==4, name(p4) ytitle(Sample 4)
qnorm trigly if sample==5, name(p5) ytitle(Sample 5)
graph combine p1 p2 p3 p4 p5,col(3) name(triglyQQ)
graph drop p1 p2 p3 p4 p5
graph export Trigly.wmf,replace
Making a plot with parired data conntected by lines
use energy.dta, clear
preserve
rename pre energy1
rename post energy2
reshape long energy,i(id) j(time)
sort id time
scatter energy time, msy(O) connect(L) aspect(1) ///
xscale( range(0.8 2.2) ) xlabel(1 " Pre" 2
"Post") ytitle( "Energy intake") xtitle("")
graph export energyts.wmf,replace
restore