Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Matrix graph


From   "Scott Merryman" <smerryman@kc.rr.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Matrix graph
Date   Wed, 1 Jun 2005 17:30:31 -0500

Ricardo,

I don't believe -graph matrix- can, but you could stitch one together with
-graph combine-

For example:

sysuse auto,clear
 
graph drop _all
*graph matrix price mpg weight, half name(g1)
 
twoway lfit mpg price, xscale(off) || scatter mpg price, ///
name(fit1) plotregion(lcolor(black) lwidth(medthick)) ///
ylabel(#4,angle(0) nogrid) ytitle("") nodraw ///
graphregion(margin(4 0 0 0 )) xscale(off) xlabel(#4) legend(off)
 
twoway lfit weight price || scatter weight price, ///
name(fit2) plotregion(lcolor(black) lwidth(medthick)) ///
ylabel(#4,angle(0) nogrid) ytitle("") nodraw ///
xtitle("") xlabel(#4) graphregion(margin(0 0 0 0)) ///
legend(off) 
 
twoway lfit weight mpg || scatter weight mpg, ///
name(fit3) plotregion(lcolor(black) lwidth(medthick)) ///
 ylabel(, nogrid) yscale(off) xtitle("") xlabel(#4) nodraw /// 
 graphregion(margin(0 0 0 0)) legend(off) 
 
local lab1: variable label price

twoway (scatter mpg price, mcolor(none) ), ///
graphregion(margin(2 0 0 0) fcolor(ltbluishgray) ///
lcolor(ltbluishgray)) plotregion(margin(zero) ///
style(none) fcolor(ltbluishgray8) lcolor(black) ///
lwidth(medium) ) text(27 8000 "`lab1'" ,size(vlarge)) ///
xscale(off) ylabel(,nogrid) yscale(off fill) name(price) nodraw
 
local lab2: variable label mpg

twoway (scatter mpg weight, mcolor(none) ), ///
graphregion(fcolor(ltbluishgray) lcolor(ltbluishgray) ) ///
plotregion(margin(zero) style(none) lcolor(black) lwidth(medium)) ///
text(26 3300 "`lab2'", size(vlarge)) xscale(off)  yscale(off) ///
ylabel(,nogrid) graphregion(margin(0 0 0 0)) name(mpg) nodraw 
 
local lab3: variable label weight

twoway (scatter weight mpg, mcolor(none) ), ///
graphregion(fcolor(ltbluishgray8) lcolor(ltbluishgray8) ) ///
plotregion(margin(zero) fcolor(ltbluishgray8) style(none) ///
lcolor(black) lwidth(medium)) text(3500 27 "`lab3'", /// 
size(vlarge)) xscale(off) yscale(off)   ylabel(,nogrid) /// 
graphregion(margin(0 0 6 0)) name(weight) nodraw
 
twoway (scatter mpg price, msymbol(point) mcolor(none) ), ///
graphregion(fcolor(ltbluishgray) lcolor(ltbluishgray) ) ///
plotregion(style(none)) xscale(off) yscale(off) ///
name(blank) nodraw 
 
graph combine price blank blank fit1 mpg blank  fit2 fit3 weight 



Hope this helps,
Scott


> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Ricardo Ovaldia
> Sent: Friday, May 27, 2005 10:48 AM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: Matrix graph
> 
> Dear Statalist,
> 
> Using -graph matrix-, is there a way to plot
> regression lines instead of scatter plots.
> 
> Regards,
> Ricardo.
> 


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index