Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: combining graphs & legends


From   Richard Hiscock <rhiscock@netspace.net.au>
To   statalist@hsphsun2.harvard.edu
Subject   st: combining graphs & legends
Date   Sun, 16 Oct 2011 17:55:05 +1100

Hello,

I am trying to combine two two-way graphs (see attached code) 
where both y & x axes are of the same scale & a legend details
the meaning of the plots.
I have tried attempted to use graph combine command however it
doesn't appear to have a legend option and if I attempt to 
combine one graph with & one without the legend no legend
appears in the combined graph. I can combine two graphs both
with a legend but this should not be required as they are the 
same. I have attempted to use either the note or caption 
option to generate a legend however keyboard symbols do not 
replicate the linepatternstyles that I have used or are 
likely to use.
Any guidance would be much appreciated.
thanks 
Richard Hiscock



**ANTERIOR

twoway 	(scatter t_mean gest_w if plac_postfund ==0,///
		ylabel(0(10)60) scheme(lean2)) ///	
		(lfit llc5a gest_w,lpattern(dot)) ///
		(lfit ulc5a gest_w, lpattern(dot)) ///
		(lfit llc95a gest_w, lpattern(dot)) ///
		(lfit ulc95a gest_w,lpattern(dot))  ///
		(lfit c95a gest_w,lpattern(shortdash_dot)) ///
		(lfit c5a gest_w, lpattern(shortdash_dot)) ///
		(lfit xba gest_w, lpattern(longdash_dot)) , ///
		l2title("Placental thickness (mm)") xtitle("") 	///
		b2title("Gestation (weeks)") ///
		title("") ///
		name(antall)

**POSTERIOR

twoway 	(scatter t_mean gest_w if plac_postfund ==1,///
		 ylabel(0(10)60) scheme(lean2)) ///	
		(lfit llc5p gest_w,lpattern(dot)) ///
		(lfit ulc5p gest_w, lpattern(dot)) ///
		(lfit llc95p gest_w, lpattern(dot)) ///
		(lfit ulc95p gest_w,lpattern(dot))  ///
		(lfit c95p gest_w,lpattern(shortdash_dot)) ///
		(lfit c5p gest_w, lpattern(shortdash_dot)) ///
		(lfit xbp gest_w, lpattern(longdash_dot)) , ///
		l2title("Placental thickness (mm)") xtitle("") ///
		b2title("Gestation (weeks)") ///
		title("") ///
		legend(label(1 "measured thickness") label(2 "") /// 
		label(3 "") label(4 "") label(5  "95% Confidence Limit") ///
		label(6 "90% Reference Interval") label(7 "") //
		label(8  "Predicted Mean") order(1 8 6 5)) ///
		name(postall)
	

graph combine antall.gph postall.gph,  	iscale(0.8) ///
		ycommon xcommon ///
		note(o measured thickness   --.--  Predicted mean  ///
		 -.-.-.-  95th centile  95%CI for centile )


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index