>>>>> On Fri, 25 Aug 2006 11:05:48 -0700 (PDT),
>>>>> Thomas Harte (TH) wrote:

  > --- Prof Brian Ripley <[EMAIL PROTECTED]> wrote:
  >> savePlot is just an internal version of dev.copy, part of the support for 
  >> the menus on the windows() graphics device.
  >> 
  >> It is described in `An Introduction to R' (the most basic R manual).

  > "the most basic R manual" doesn't quite answer my question. 

  > by itself, dev.copy doesn't copy the width and height of the device whereas 
savePlot
  > copies whatever is displayed on the screen giving me 
what-you-see-is-what-you-save
  > capabilities (but only under the Windows OS). 

  > i can get pretty close to this in linux by writing a function to save the
  > plot to a pdf device:
  > <<label=first.ar.1, results=hide>>=
  >     # no savePlot in Linux ... so write my own function
  >     savePlotAsPdf<- function(pdfname, from=dev.cur()) {
  >             from<- from
  >             pdf(pdfname, width=width, height=height)
  >             to<- dev.cur()
  >             dev.set(from)
  >             dev.copy(which=to)
  >             dev.off()
  >     }
  >     # a long AR process is best viewed in a wide window ... 
  >     # width & height are now variables
  >     width<- 20; height<- 5
  >     x11(width=width, height=height)
  >     sp<- make.ar.1(alpha=.5, n=800)
  >     plot(sp, type="l", col="blue")
  >     # width & height via dynamic scoping in savePlotAsPdf
  >     savePlotAsPdf("ar.pdf")
  > @

Umm, maybe I don't get your point, but in what way does the complicated
code above do anythingdifferent from

**********************************************************

<<results=hide>>=
sp<- make.ar.1(alpha=.5, n=800)
@

<<ar,fig=true,width=20,height=5,include=false>>=
plot(sp, type="l", col="blue")
@

\begin{figure}
  \includegraphics[width=14.5cm]{myprefix-ar}
\end{figure}

**********************************************************

???

Best,

-- 
-----------------------------------------------------------------------
Prof. Dr. Friedrich Leisch 

Institut für Statistik                          Tel: (+49 89) 2180 3165
Ludwig-Maximilians-Universität                  Fax: (+49 89) 2180 5308
Ludwigstraße 33
D-80539 München                 http://www.stat.uni-muenchen.de/~leisch

______________________________________________
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.

Reply via email to