[R-gui] plot.new() within tkrplot, coplot

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sat Jun 26 11:51:02 CEST 2004


James Wettenhall <wettenhall at wehi.edu.au> writes:

> Hi,
> 
> Does anyone know a good way to get rid of warnings like:
> Warning message: 
> calling par(new=) with no plot 
> 
> when using an R plot function which calls plot.new() 
> (e.g. coplot) from within tkrplot?
> 
> For example:
> 
> library(tkrplot)
> tt <- tktoplevel()
> plotFun <- function() {
>   data(quakes)
>   coplot(lat ~ long | depth, data = quakes)
> }
> img <- tkrplot(tt,fun=plotFun)
> 
> Warning message: 
> calling par(new=) with no plot 
> 
> tkpack(img)
> 
> The plot looks fine in the Tk window, but I'm just 
> wondering whether I can get rid of the warning message.

Hmm, the same wart appears if you just plot to a freshly opened X11
device (X11(); coplot(....)), nothing specific to tkrplot. I think
I've seen this reported before, but I have forgotten what the
recommended action was.
 
> On a similar subject, does anyone have any general advice on 
> whether it is best to pass main="Plot Title" directly to the 
> plot function or whether it is best to use title() for ploting
> within tkrplot?  Or doesn't it matter?  I'm having trouble 
> finding a reproducible example now, but I have experienced 
> errors like: 
> "Cannot set parameter main in high-level plot function", 

Well, title just splats some text at a defined position on the plot,
whereas main= requires cooperation from the high-level plot function.
I can't recall examples of uncooperative plot functions either, but
you should probably consider if there's a reason why those plots might
not *want* to have a title...
 
> and I wonder whether these errors are related to using tkrplot 
> and R2HTML's HTMLplot, rather than the regular R graphics device.

Both are generic, I think.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907



More information about the R-SIG-GUI mailing list