Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Multiple bar/rcap graphs as 1 file


From   "Svend Juul" <[email protected]>
To   <[email protected]>
Subject   Re: st: Multiple bar/rcap graphs as 1 file
Date   Mon, 21 May 2007 10:08:46 +0200

Dan wrote

I use the following excerpt of a do file to generate a series of graphs
(1 national and 5 regional)

Each graph has its own title etc, but is set to the same X and Y scales

At present, I get 1 figure for each state/sex/age group combination,
which is great. However for publication, it would be great to get 1
figure which combines the 6 graphs as 2 wide and 3 deep. 

Can anybody please suggest the code to do this? 

 twoway (bar rate var1  if var2==1, bfc(gs15)) ///
          (bar rate var1 if var2==2, bfc(gs10)) ///
          (bar rate var1 if var2==3, bfc(gs1)) ///
          (rcap ub1 lb1 var1, bfc(gs10)), ///
          title("`atitle' `btitle'") ///
          subtitle("`ctitle' `dtitle' ") ///
         legend( order(1  2 3 4) ) ///
          xlabel(" ") ///
       ylabel(0(`rng')`max') xtitle() ytitle("") ///
	 graph export "`a'fig.wmf", replace

-------------------------------------------------------------------

Instead of exporting each graph to .wmf format, store it as a "memory
graph":

     ... name(`a' , replace)

Next, use -graph combine-. Assuming that the names of the graphs are
g1-g6:

     graph combine g1 g2 g3 g4 g5 g6 , cols(2)

You may then export the combined graph to, e.g., wmf format.

Hope this helps
Svend
__________________________________________

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000  Aarhus C, Denmark
Phone: +45 8942 6090
Home:  +45 8693 7796
Email: [email protected]
__________________________________________ 

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index