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" <SJ@SOCI.AU.DK>
To   <>
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

     ... name(`a' , replace)

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

     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 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

*   For searches and help try:

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