[6479] in s-news-athena

home help back first fref pref prev next nref lref last post

Re: pairs() bug??

daemon@ATHENA.MIT.EDU (Prof. Brian Ripley)
Wed Feb 22 04:42:57 1995

Date: Wed, 22 Feb 95 09:03:50 GMT
From: ripley@stats.ox.ac.uk (Prof. Brian Ripley)
To: gonzo@u.washington.edu
Cc: S-news@utstat.toronto.edu

> From: Rich Gonzalez <gonzo@u.washington.edu>
> Subject: pairs() bug??
> 
> The pairs() code suggests that I could pass ylim & xlim arguments to the
> plot command so all the plots have the same ylim and xlim of my choosing.
> I got an error message when I tried that.   That is,
> 
> pairs(x,y,panel=myfunction,ylim=c(0,1), xlim=c(0,1))
>

Here is some earlier correspondence: the archives are often useful!

Brian Ripley

----- Begin Included Message -----

From: shyu@research.att.com
Date: Wed, 7 Dec 94 09:36 EST
To: s-news@utstat.toronto.edu
Subject: Re: Axis limits in Pairs() <trellis> or pairs()

John Maindonald (john@maths.marc.cri.nz) wrote :

> Date: Wed, 7 Dec 94 12:42:18 +1300
> From: John Maindonald <john@maths.marc.cri.nz>
> Message-Id: <9412062342.AA12008@maths.marc.cri.nz>
> To: s-news@utstat.toronto.edu
> Subject: Axis limits in Pairs() <trellis> or pairs()
> Status: RO
> 
> I can find no way to set the axis limits when I use Pairs().
> Specifying xlim = generates the message: Unknown parameter xlim.
> 
> I'll be grateful for any clues.

He has indeed found a bug in the pairs() code! what happened is that
xlim got packed into "..." and sent down to the panel() function
that does the plotting.  The panel() function is usually a simple call
to points(), therefore resulting in the "Unknown parameter xlim" error
message.  I have a revised version of pairs.default() that contains the
fix.  To summarize the fixes, I replaced two lines of codes :

Replace :

"pairs.default"<-
function(x, labels = dimnames(x)[[2]], panel = panel.pairs, minlength = c(4, 7),        subscripts = F, key.arg = list(), ...)

By :

"pairs.default"<-
function(x, labels = dimnames(x)[[2]], panel = panel.pairs, minlength = c(4, 7),        subscripts = any(names(panel) == "subscripts"), key.arg = list(), 
        xlim = NULL, ylim = NULL, ...)

And also replace :

.S(plot(xrange[[j]], xrange[[i]], type = "n", axes = F, ...), "plot")

By :

.S(plot(if(!is.null(xlim)) xlim else xrange[[j]],
        if(!is.null(ylim)) ylim else xrange[[i]],
	type = "n", axes = F), "plot")

Hope this helps!


 o=======================================================================o
 | Ming-Jen Shyu (Ming)                 INTERNET:  shyu@research.att.com |
 | AT&T Bell Laboratories, Room 2C-263  UUCP:      attmail!research!shyu |
 | 600 Mountain Avenue                  office:    (908) 582-6863        |
 | Murray Hill, NJ 07974-2070, USA      fax:       (908) 582-3340        |
 o=======================================================================o


----- End Included Message -----


home help back first fref pref prev next nref lref last post