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]

RE: st: Saving multiple graphs


From   "David Radwin" <dradwin@mprinc.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Saving multiple graphs
Date   Fri, 28 Oct 2011 08:23:58 -0700 (PDT)

Nicola,

On your first question, instead of saving each graph to a file, you might
save the graph in memory with a unique name, then use -graph combine- to
combine them all into one big graph. Like this:

foreach y of varlist bwkg length pondi hcn man ssn trn  {
	qnorm `y', name(`y', replace)
	local graphnames `graphnames' `y'
	}
graph combine `graphnames'


On your second question, do you mean something like this?

http://www.stata.com/includes/contimages/matrix1.gif

If so, try -graph matrix-.

David
--
David Radwin
Research Associate
MPR Associates, Inc.
2150 Shattuck Ave., Suite 800
Berkeley, CA 94704
Phone: 510-849-4942
Fax: 510-849-0794

www.mprinc.com

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Vitorino, Maria Ana
> Sent: Friday, October 28, 2011 8:08 AM
> To: <statalist@hsphsun2.harvard.edu>
> Subject: Re: st: Saving multiple graphs
> 
> Dear Nicola,
> My guess is that you need to include `y' in the name of the saved plot.
> Otherwise it's just overwriting the file every time that the variable
> changes.
> 
> Something like this should work:
> 
> foreach y of varlist bwkg length pondi hcn man ssn trn  {
> qnorm `y'
> qui graph export "f:/Nicola/SWS_India2/qnorm`y'.png", replace
>    }
> 
> 
> Hope this helps,
> 
> Ana
> 
> 
> On Oct 28, 2011, at 10:57 AM, Nicola Winder wrote:
> 
> > Dear Statalist,
> >
> > Does anyone know of a way to produce and save a matrix or series of
> graphs?
> > I am simply wanting to examine the Q-Q plots of 40 variables and have
> tried the following:
> >
> > foreach y of varlist bwkg length pondi hcn man ssn trn  {
> > qnorm `y'
> > qui graph export "f:/Nicola/SWS_India2/qnorm.png", replace
> >    }
> >
> > The loop works fine but the plots literally flash up and only the last
> plot is exported. Also these plots are only exploratory and will not be
> published so the quality does not matter.
> >
> > Also in R it is possible to use pairwise scatter var1 var2 var3 var4
etc
> to get a matrix of scatter plots does Stata do anything like this for
> exploratory purposes?
> >
> > Many thanks in advance for your help!
> > (I am using Stata version 11.1 windows XP)
> >
> > Nicola

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