Statalist


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

Re: st: Still Thinking or Resisting


From   Eric Booth <[email protected]>
To   [email protected]
Subject   Re: st: Still Thinking or Resisting
Date   Fri, 4 Dec 2009 15:02:23 -0600

>
>
Sungbok:
I tried your example on Stata 11 MP on Mac OSX 10.7 with 32G of mem & again on Stata 11SE on Windows Server 2003 with 10G of mem but I could not reproduce the problem.  The latter system got a bit slower when generating more than about 30 graphs, but it did not freeze.

Since you stated that you've found that there is some limit in terms of the number of graphs that will open, based on memory allocation, I think your best solution would be to not allow Stata to open all those graph windows/tabs at the same time.  

To do so, I would put commands in your loop to save the graphs, export them to your favorite format that can be opened in an external program (e.g., .pdf, .eps, etc.), and then close the graph window before generating the next graph in the loop.  I don't know what the benefit of having all 40 graphs open at the same time would be unless you wanted to compare them in some kind of -graph combine- scenario--if you simply want to tab through them in fullscreen, you can do that in another program.

I've modified your do-file with these changes (closing/saving the graph windows & creating a combined graph window at the end), you can then go and open your newly created graphs in some external graphic-viewing program:

*********

clear all
set more off
set mem 32g                                              

set graphics on
set obs 20000
gen x = runiform()
gen y = rnormal()

local in = 40  
g str5 graph_name = ""    //<-- for later use with -graph combine-
         
                                   
forvalues i=1(1)`in'{
twoway(scatter x y)(line y x), name(toy`i')
graph save toy`i'.gph, replace
graph export gr`i'.eps, as(eps) replace name(toy`i')
window manage close graph toy`i'
replace graph_name = "toy`i'" in `i'
}


//for a combined graph//
levelsof graph_name, local(gn)
graph combine `gn'
graph save all_toy.gph, replace
graph export all_top.eps, as(eps) replace
drop graph_name
*********
**note**  I turned off tabbed graphics windows preference in the Windows OS version of Stata (it's not an option in the Mac OSX version of Stata)...I didn't try this with the tabbed graphics window preference on.



~ Eric

__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
[email protected]
Office: +979.845.6754


On Dec 4, 2009, at 12:04 PM, javanfish wrote:

> Thanks for your comments. I also saved all graphs generated by loop and selected graphs for combining with the commands of `graph use' and `graph store' by loop. But, sometimes, I press a button for maximizing the window size without a caution. This freezing problem occurs even when pressing 'graph edit'. My STATA 11 is 64-bit MP version on Windows Vista. I allocate 20g for memory partly because my data size is huge and partly because the installed memory is 32g. I also simulated a simple case. I found that it may depend on the number of graphs, the allocated memory size and the option of graphic window. Actually, it does not matter with the capacity of processing graphs in STATA. I sometimes hope to save the codes even when encountering this freezing. Thanks again, and I will communicate with STATA.com later.
> 
> If anyone is wondering this problem, try it.
> 
> * open stata --> edit --> preferences --> graph preferences --> check "Create multiple graphs as tabs in a single window"
> 
> clear all
> set more off
> set mem 10g                                              /* <- change as you have */
> 
> set graphics on
> 
> set obs 2000
> gen x = runiform()
> gen y = rnormal()
> 
> local in = 40                                               /* <- change as you want */
> forvalues i=1(1)`in'{
> 
> twoway(scatter x y)(line y x), name(toy`i')
> 
> }
> 
> 
> 
> 
> Sungbok Lee
> 
> 4th Year Graduate
> Department of Economics
> TAMU
> [email protected]
> 422-1088
> http://www.searchatall.com
> 
> --------------------------------------------------
> From: "Clyde Schechter" <[email protected]>
> Sent: Friday, December 04, 2009 9:31 AM
> To: <[email protected]>
> Subject: Re: st: Still Thinking or Resisting
> 
>> FWIW, I had a similar problem several months back.  I was generating a
>> fairly large number of graphs within nested loops and then combining them.
>> It all worked fine until I tried to maximize the graph window, which
>> would cause my computer to crash.
>> 
>> I sent Stata tech support the data and code: they were unable to reproduce
>> the problem on their machines.  I subsequently re-ran my code on another
>> machine, and ultimately on a few other machines, with no problem
>> whatsoever.  The problem persists on the machine which originally produced
>> the problem.
>> 
>> My best guess is that it is either a hardware problem or some difficulty
>> with the graphics-handling part of the OS that causes this.
>> 
>> As a work-around when I have to use the problematic machine, I do what
>> another person suggested on this list: I export the combined graph and
>> then open it in a picture-viewing application.
>> 
>> I suggest you send your data and code to Stata tech support.  If they do
>> find a problem in Stata, let the list know--there may be others who have
>> encountered this.  But, if I were you, I'd also check and see if the
>> problem is reproducible on another computer.
>> 
>> Good luck.
>> 
>> Clyde Schechter
>> Albert Einstein College of Medicine, Bronx, NY, USA
>> 
>> 
>> *
>> *   For searches and help try:



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