Dear Statalist,
I would like to merge three or more marginsplots in just one graph but I do not kwow how to do that. I have this example codes to merge two graphs but i do not know how to merge a possible third marginsplot, what should I add in order to obtain three graphs altogether?
Thank you so much
sysuse auto, clear
egen zweight=std(weight)
egen zlength=std(length)
regress mpg zweight zlength
margins, at(zweight=(-3(.25)3)) saving(margins1, replace)
marginsplot, recast(line) noci name(g1, replace)
margins, at(zlength=(-3(.25)3)) saving(margins2, replace)
marginsplot, recast(line) noci name(g2, replace)
use _at _margin using margins1, clear
rename _margin weight
merge 1:1 _n using margins2
rename _margin length
keep _at weight length
graph twoway (line weight _at) ///
(line length _at)
I would like to merge three or more marginsplots in just one graph but I do not kwow how to do that. I have this example codes to merge two graphs but i do not know how to merge a possible third marginsplot, what should I add in order to obtain three graphs altogether?
Thank you so much
sysuse auto, clear
egen zweight=std(weight)
egen zlength=std(length)
regress mpg zweight zlength
margins, at(zweight=(-3(.25)3)) saving(margins1, replace)
marginsplot, recast(line) noci name(g1, replace)
margins, at(zlength=(-3(.25)3)) saving(margins2, replace)
marginsplot, recast(line) noci name(g2, replace)
use _at _margin using margins1, clear
rename _margin weight
merge 1:1 _n using margins2
rename _margin length
keep _at weight length
graph twoway (line weight _at) ///
(line length _at)
Comment