|
给个例子你吧:
sysuse auto.dta, clear
// Graph 1: Price vs. Mileage
gr tw sc price mpg, ///
graphregion(color(white)) ///
title("Price vs. Mileage", ring(1) pos(12) size(*0.8))
gr save "C:/Documents/Statadocs/gr1.gph", replace
// Graph 2: The average mileage of domesic versus foreign cars
gr bar (mean) mpg, over(foreign) ///
legend(lab(1 "Domestic") lab(2 "Foreign") nobox ring(1) pos(3) col(1) symxsize(*0.25) order(2 1)) ///
blabel(bar, position(center) format(%12.1f) color(white) size(*1.025)) ///
title("Average mileage, Domestic vs. Foreign cars", size(*0.9)) ///
ytitle("Percent", size(*0.9)) ///
ylabel(, nogrid) ///
yscale(off) ///
graphregion(color(white))
gr save "C:/Documents/Statadocs/gr2.gph", replace
// Combining graphs horizontally (in one row)
graph combine ///
"C:/Documents/Statadocs/gr1.gph" ///
"C:/Documents/Statadocs/gr2.gph", ///
row(1) graphregion(color(white)) xsize(7) ysize(4)
gr export "C:/Documents/Statadocs/combined_horizontal.emf", replace
// Combining graphs horizontally (in one column)
// Notice how we change the aspect ratio with xsize() and ysize()
graph combine ///
"C:/Documents/Statadocs/gr1.gph" ///
"C:/Documents/Statadocs/gr2.gph", ///
row(2) col(1) graphregion(color(white)) xsize(4) ysize(7)
gr export "C:/Documents/Statadocs/combined_vertical.emf", replace
|