[R] Recalling and printing multiple graphs. Is there something in the HISTORY menu that will help?

2007-03-06 Thread John Sorkin
I have written an R function that produces multiple graphs. I use
par(ask=TRUE) to allow for the inspection of each graph before the next
graph is drawn. I am looking for a way to recall all graphs drawn in an
R session, and a method that can be used to print all the graphs at one
time. I know that I could simply print each graph after I inspect the
graph, but this gets tiresome if one's function produces tens of graphs.
I suspect that if I knew more about the history menu (which currently
has an entry RECORDING) I could get the graphs to be replayed and
printed, but alas I have not been able to find instructions for using
the HISTORY menu. Please take pity on my  when you let me know that some
easy search or command could get me the information I needed. I have
looked, but clearly in the wrong places.
John 
 
 
John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
Baltimore VA Medical Center GRECC,
University of Maryland School of Medicine Claude D. Pepper OAIC,
University of Maryland Clinical Nutrition Research Unit, and
Baltimore VA Center Stroke of Excellence

University of Maryland School of Medicine
Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524

(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)
[EMAIL PROTECTED]
Confidentiality Statement:
This email message, including any attachments, is for the so...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Recalling and printing multiple graphs. Is there something in the HISTORY menu that will help?

2007-03-06 Thread jim holtman
Here is a function that I have used to write the files on my Windows
machine.  I put this function call after each graph that I produce and it
will write out a new file and tell me what the file name is.  I can then go
back and copy the files into a document or a PowerPoint presentation.


f.plot - local({
# PlotNumber is 'local' to the function
PlotNumber - 1 # initialize the plot number
function(){   # return the function
  myplot - sprintf(ws.%03d.wmf, PlotNumber)
  dev.copy(win.metafile, file=myplot, width=10, height=7)
  PlotNumber - PlotNumber + 1  # increment for next plot
  cat(copied to:, myplot, \n)
  invisible(dev.off())  # close the file
}
})

At the end of each plotting sequence, just call f.plot() to save the
image.


On 3/6/07, John Sorkin [EMAIL PROTECTED] wrote:

 I have written an R function that produces multiple graphs. I use
 par(ask=TRUE) to allow for the inspection of each graph before the next
 graph is drawn. I am looking for a way to recall all graphs drawn in an
 R session, and a method that can be used to print all the graphs at one
 time. I know that I could simply print each graph after I inspect the
 graph, but this gets tiresome if one's function produces tens of graphs.
 I suspect that if I knew more about the history menu (which currently
 has an entry RECORDING) I could get the graphs to be replayed and
 printed, but alas I have not been able to find instructions for using
 the HISTORY menu. Please take pity on my  when you let me know that some
 easy search or command could get me the information I needed. I have
 looked, but clearly in the wrong places.
 John


 John Sorkin M.D., Ph.D.
 Chief, Biostatistics and Informatics
 Baltimore VA Medical Center GRECC,
 University of Maryland School of Medicine Claude D. Pepper OAIC,
 University of Maryland Clinical Nutrition Research Unit, and
 Baltimore VA Center Stroke of Excellence

 University of Maryland School of Medicine
 Division of Gerontology
 Baltimore VA Medical Center
 10 North Greene Street
 GRECC (BT/18/GR)
 Baltimore, MD 21201-1524

 (Phone) 410-605-7119
 (Fax) 410-605-7913 (Please call phone number above prior to faxing)
 [EMAIL PROTECTED]
 Confidentiality Statement:
 This email message, including any attachments, is for the so...{{dropped}}

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Recalling and printing multiple graphs. Is there something in the HISTORY menu that will help?

2007-03-06 Thread Petr Klasterecky
options(graphics.record=TRUE)
can be used to switch the recording on (MS Windows, not sure about other 
platforms). See ?options
To set this option as default, use .Rprofile

It is however quite annoying to examine and save all the graphs 
manually... You might find functions like postscript(), png(), jpeg() 
and others useful.

Petr

John Sorkin napsal(a):
 I have written an R function that produces multiple graphs. I use
 par(ask=TRUE) to allow for the inspection of each graph before the next
 graph is drawn. I am looking for a way to recall all graphs drawn in an
 R session, and a method that can be used to print all the graphs at one
 time. I know that I could simply print each graph after I inspect the
 graph, but this gets tiresome if one's function produces tens of graphs.
 I suspect that if I knew more about the history menu (which currently
 has an entry RECORDING) I could get the graphs to be replayed and
 printed, but alas I have not been able to find instructions for using
 the HISTORY menu. Please take pity on my  when you let me know that some
 easy search or command could get me the information I needed. I have
 looked, but clearly in the wrong places.
 John 
  
  
 John Sorkin M.D., Ph.D.
 Chief, Biostatistics and Informatics
 Baltimore VA Medical Center GRECC,
 University of Maryland School of Medicine Claude D. Pepper OAIC,
 University of Maryland Clinical Nutrition Research Unit, and
 Baltimore VA Center Stroke of Excellence
-- 
Petr Klasterecky
Dept. of Probability and Statistics
Charles University in Prague
Czech Republic

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Recalling and printing multiple graphs. Is there something in the HISTORY menu that will help?

2007-03-06 Thread John Sorkin
I am re-sending this Email message as it does not appear to have been
received my the R mail list Daemon. My apologies of you receive two
copies of this message. If you do, it will mean that the first message
finally made it through cyberspace to the list server. 
 
I have written an R function that produces multiple graphs. I use
par(ask=TRUE) to allow for the inspection of each graph before the next
graph is drawn. I am looking for a way to recall all graphs drawn in an
R session, and a method that can be used to print all the graphs at one
time. I know that I could simply print each graph after I inspect the
graph, but this gets tiresome if one's function produces tens of graphs.
I suspect that if I knew more about the history menu (which currently
has an entry RECORDING) I could get the graphs to be replayed and
printed, but alas I have not been able to find instructions for using
the HISTORY menu. Please take pity on my  when you let me know that some
easy search or command could get me the information I needed. I have
looked, but clearly in the wrong places.
John 
 
 
John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
Baltimore VA Medical Center GRECC,
University of Maryland School of Medicine Claude D. Pepper OAIC,
University of Maryland Clinical Nutrition Research Unit, and
Baltimore VA Center Stroke of Excellence

University of Maryland School of Medicine
Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524

(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)
[EMAIL PROTECTED]
Confidentiality Statement:
This email message, including any attachments, is for the sole use of
the intended recipient(s) and may contain confidential and privileged
information.  Any unauthorized use, disclosure or distribution is
prohibited.  If you are not the intended recipient, please contact the
sender by reply email and destroy all copies of the original message. 

[[alternative HTML version deleted]]


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Recalling and printing multiple graphs. Is there something in the HISTORY menu that will help?

2007-03-06 Thread Mike Prager
John Sorkin [EMAIL PROTECTED] wrote:

 I have written an R function that produces multiple graphs. I use
 par(ask=TRUE) to allow for the inspection of each graph before the next
 graph is drawn. I am looking for a way to recall all graphs drawn in an
 R session, and a method that can be used to print all the graphs at one
 time. I know that I could simply print each graph after I inspect the
 graph, but this gets tiresome if one's function produces tens of graphs.
 I suspect that if I knew more about the history menu (which currently
 has an entry RECORDING) I could get the graphs to be replayed and
 printed, but alas I have not been able to find instructions for using
 the HISTORY menu. Please take pity on my  when you let me know that some
 easy search or command could get me the information I needed. I have
 looked, but clearly in the wrong places.
  
 John Sorkin M.D., Ph.D.

I assume you are on Windows (please give OS and R version in
future help requests).  

The code I use before starting such functions is

graphics.off()
windows(record=TRUE)
.SavedPlots - NULL

which closes existing graphics devices, opens a windows device
with recording on, and deletes any existing graphics history.

You can go through the history with PageUp and PageDown keys.

Within your function, you can call savePlot (q.v.) to save each
plot to a file just after it is generated.

HTH

-- 
Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.