Skip to content

Graphic Device - View/get all graphics

6 messages · David Winsemius, Greg Snow, Don MacQueen +2 more

#
Hi Listers,
I am producing some graphics that the commands are in a FUNCTION...
The problem is that I end up viewing just last graphic and in my FUNCTION
there are 4 graphics with the PAR command function... Like those below...
How do I view/get the other 3 graphics? Any help?
Thanks in advance...

histogram<-par(mfrow=c(1,2))
hist(rw_mean_app,main='Bootstrap Method RWOriginal',xlab='Mean',ylab=' ')
hist(rwy_mean_app,main='Bootstrap Method RWY',xlab='Mean',ylab=' ')
par(histogram)

histogram<-par(mfrow=c(1,3))
hist(rw_median_app_ori,main='Bootstrap Method
RWOriginal',xlab='Median',ylab=' ')
hist(rw_median_app_mod,main='Bootstrap Method
RWModified',xlab='Median',ylab=' ')
hist(rwy_median_app,main='Bootstrap Method RWY',xlab='Median',ylab=' ')
par(histogram)
#
On Nov 24, 2009, at 11:52 AM, MarcioRibeiro wrote:

            
It  may depend on your OS. Generally there is a sequence of plots  
stored in the graphics buffer and you need to figure out how to page  
backwards. On a Mac using the GUI, that is done with cmd-<back-arrow>.  
If that does not work, then perhaps the results of the undisclosed  
FUNCTION were simply the last object evaluation and you need to store  
your objects in a list before exiting that environment.
#
There are multiple ways, some are OS specific (and I don't see where you told us that).

Some things to try:

par(ask=TRUE)

# or

pdf('tempfile.pdf')
yourfunctionhere()
dev.off()

# or

par(mfrow=c(2,2))

# or 

Windows(record=TRUE)

# or

Look at the help for the function creating the plots, some have options to produce a specified plot, the default is multiple ones.
#
You might try putting

   readline('CR to continue')

between the two sets of plot commands.

-Don
At 8:52 AM -0800 11/24/09, MarcioRibeiro wrote:

  
    
2 days later
#
Hello,
After some research, I didn't resolve my doubt yet...
Maybe I didn't explain very well my question... So, I have a bootstrap
simulation, but suppose just a simple part of my function:

teste <-function(x){
rw_mean_app<-rnorm(x, mean = 10, sd = 2)
rwy_mean_app<-rnorm(x, mean = 10, sd = 2)
rw_median_app_ori<-rnorm(x, mean = 10, sd = 2)
rw_median_app_mod<-rnorm(x, mean = 10, sd = 2)

histogram<-par(mfrow=c(1,2),ask=TRUE)
hist(rw_mean_app,main='Method RWOriginal',xlab='Mean',ylab=' ')
hist(rwy_mean_app,main='Method RWY',xlab='Mean',ylab=' ')
par(histogram)

histogram<-par(mfrow=c(1,2) ,ask=TRUE)
hist(rw_median_app_ori,main='Method RWOriginal',xlab='Median',ylab=' ')
hist(rw_median_app_mod,main='Method RWModified',xlab='Median',ylab=' ')
par(histogram)

}   #END OF FUNCTION
GRAF<-teste(100)

I cannot save rnorm objects in a list cause they are distribution from 1000
simulation... So, I would like to produce the graphics in my function and
find out a way that I could save the graphics... I can save the object using
the LIST procedure, but I dont know how I save an object that is a
graphic...
Listers, I just want some advices in order to make a research about what
functions of R I could save the graphics in my function...
Thanks again,
Marcio
MarcioRibeiro wrote:

  
    
#
I'm not entirely sure I understand the problem, but one possible solution
would be to use some device like postscript that saves the graphics to a
file. (Or some other device appropriate for your intended use and OS.)

You could still save the data to a list if you wanted - just make it part
of what your function returns.

Sarah
On Fri, Nov 27, 2009 at 12:10 PM, MarcioRibeiro <mestat at pop.com.br> wrote: