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

From |
Ulrich Kohler <ukohler@sowi.uni-mannheim.de> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Graphs and Log files |

Date |
Wed, 11 Dec 2002 09:01:44 +0000 |

Ricardo Mora-Castrillo wrote > I am trying to run some graphs a the same time using this command: > > foreach var of varlist x1 x2 x3 x4 x5 x6 x7 x8 x9 {graph `var' y, by (z) } > > My questions is how can I get all the graphs in one singles log file? While it is not possible to save graphs in log files I guess your question is on how to get all the graphs in one single "gph" file. One way is to save each graph seperatelly within the loop and to combine them with graph using afterwards: --------------- foreach var of varlist x1 x2 x3 x4 x5 x6 x7 x8 x9 { graph `var' y, by (z) saving(`var', replace) } graph using x1 x2 x3 x4 x5 x6 x7 x8 x9, saving(filename, replace) --------------- Depending on the number of graphs you combine, there will be an issue of placement. -graph using- allways places the graphs in kXk matrices. With 9 graphs you will get 3 rows and 3 columns, which is ok. With 10 graphs you will get 4 rows and 4 columns which leaves a lot of empty space. You can get some control over the placements of the graphs in the 4*4 space by using an empty graph. Even more freedom is possible by using the -gph- commands. Something like this: ----------------- capture program drop mygraph program define mygraph gph open, saving(mygraph, replace) graph x1 y, by(z) bbox(....) graph x2 y, by(z) bbox(....) graph x3 y, by(z) bbox(....) gph close end mygraph ----------------- Use -bbox- to place the graph in the graph-window wherever you like. More on this is found in the Graphics Manual [G] gph. One additional comment. You wrote: > I am > trying to avoid the copy/paste solution, because that would force me to do > it out of the foreach Therefore it seems to me, that the goal is to export the graphs to a Word-Processor. In this case you might be better of to use the following loop: foreach var of varlist x1 x2 x3 x4 x5 x6 x7 x8 x9 { graph `var' y, by (z) translate @Graph `var'.wmf } This translates each graph to a Windows-Metafile which can be imported into Word. If you change the extension from wmf to eps you will end up with a EPS file which may be included into LaTex. hope this helps uli -- ukohler@sowi.uni-mannheim.de http://www.sowi.uni-mannheim.de/lesas * * 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/

**Follow-Ups**:**Re: st: Graphs and Log files***From:*Ricardo Mora-Castrillo <ricmorca@prc.utexas.edu>

**References**:**st: Graphs and Log files***From:*Ricardo Mora-Castrillo <ricmorca@prc.utexas.edu>

- Prev by Date:
**st: Graphs and Log files** - Next by Date:
**deleting observations [was: RE: st: about deleting variables]** - Previous by thread:
**st: Graphs and Log files** - Next by thread:
**Re: st: Graphs and Log files** - Index(es):

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