Thanks for your help.
Code:
cwf default cap frame drop auto frame create auto cwf auto sysuse auto gen brand_s = ustrword(make,1,"en") collapse (mean) len=length (count) freq=length, by(brand_s) keep if freq>2 encode brand_s, gen(brand) gen brand_1 = 1 clonevar lenp = len format lenp %5.0fc set scheme s2color twoway (scatter brand_1 len if inlist(brand,1), mlabel(brand) mlabp(12) mlabgap(2) mc(green) mlabc(green)) /// (scatter brand_1 len if inlist(brand,11), mlabel(brand) mlabp(12) mlabgap(4) mc(orange) mlabc(orange)) /// (scatter brand_1 len if inlist(brand,4,3,7,8,5), mlabel(brand) mlabp(6) mc(blue) mlabc(blue)) /// (scatter brand_1 len if inlist(brand,2,6), mlabel(brand) mlabp(4) mc(blue) mlabc(blue)) /// (scatter brand_1 lenp if inlist(brand,1), mlabel(lenp) mlabp(6) mlabgap(2) m(i) mlabc(green)) /// (scatter brand_1 lenp if inlist(brand,11), mlabel(lenp) mlabp(6) mlabgap(4) m(i) mlabc(orange)) /// (scatter brand_1 lenp if inlist(brand,4,3,7,8,5), mlabel(lenp) mlabp(12) mlabgap(1.5) m(i) mlabc(blue)) /// (scatter brand_1 lenp if inlist(brand,2,6), mlabel(lenp) mlabp(12) mlabgap(1.5) m(i) mlabc(blue)) /// , ysc(off) xsc(off) xtitle("") legend(off) name(sc_brand, replace)
0 Response to Reduce margin (y-scale) around scatter plot
Post a Comment