[R] ?plot problem

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jun 25 10:01:06 CEST 2003


The critical fact here is that you called dev.off() and then re-open a
device: I don't recall that being mentioned before (and it works unless
you do that).  dev.off() does not save the current plot (it will in
1.8.0), so you need to call recordPlot()  before dev.off().

The current plot is recorded if you move away from it or start a new plot.

On Tue, 24 Jun 2003, Paul, David  A wrote:

> Thanks to Dr. Thomas Hotz, Prof. Brian Ripley, Dr. Dennis
> Murphy, and Dr. David Scott for their replies.
> 
> Trying an idea:
> 
> > x <- c(1,2,3,4)
> > y<-c(2,4.2,5.9,9)
> > temp<-data.frame(cbind(x,y))
> > attach(temp)
> > temp.lm <- lm(y~x)

This is pointless: the x and y in the user's workspace are used.
Use lm(y ~ x, data=temp).

> > windows()

Unneeded.

> > plot(temp.lm)
> Hit <Return> to see next plot: 
> Hit <Return> to see next plot: 
> Hit <Return> to see next plot: 
> Hit <Return> to see next plot: 

call recordPlot() here

> > dev.off()
> > windows()
> 
> I was unable to see the Cook's distance plot as before (using
> the Page Up and Page Down keys).  So I implemented another
> suggestion:
> 
> > windows()
> > plot(temp.lm)
> Hit <Return> to see next plot: 
> Hit <Return> to see next plot: 
> Hit <Return> to see next plot: 
> Hit <Return> to see next plot: 
> [Use Menu: History|Add]
> 
> After doing this, the Cook's distance plot was "saved" so that
> Page Up and Page Down worked properly.  Question:  Is there
> a way to use a line command to "add" the last graph to the
> history?
> 
> 
> Much thanks again,
>   david paul
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list