From gavin.simpson at ucl.ac.uk  Fri Feb  1 19:08:54 2008
From: gavin.simpson at ucl.ac.uk (Gavin Simpson)
Date: Fri, 01 Feb 2008 18:08:54 +0000
Subject: [Rd] bug using matplot (PR#10676)
In-Reply-To: <20080201152003.2847B2834848@mail.pubhealth.ku.dk>
References: <20080201152003.2847B2834848@mail.pubhealth.ku.dk>
Message-ID: <1201889334.20085.62.camel@prometheus.geog.ucl.ac.uk>

hits=-2.6 tests=BAYES_00
X-USF-Spam-Flag: NO

On Fri, 2008-02-01 at 16:20 +0100, cori at u707.jussieu.fr wrote:
> Full_Name: Anne CORI
> Version: 2.6.1
> OS: windows
> Submission from: (NULL) (134.157.220.19)
> 
> 
> let A be a mtrix with n lines and p columns, p>36 ;
> 
> matplot(A) will only draw the plot of the first 36 columns of A.
> 
> This is due to a bug in the definition of pch in the function : 
> 
> pch <- c(paste(c(1:9, 0)), letters)[1:k]

You need this here, the issue is that the default is only length 36 and
you aren't warned if you have more variables than that *if* you rely
upon the default and don't specify pch in you call to matplot.

This works fine for example:

dat <- matrix(rnorm(400), ncol = 40)
matplot(dat, pch = c(paste(1:9, 0, letters, LETTERS)))

> 
> should be replaced by 
> 
> pch <- c(paste(c(1:9, 0)), letters)

That won't help. The vector, pch, will get recycled so you won't be able
to tell the difference between vars 1,2,3 etc and 37,38,39 etc. (See the
series of if(length(.....) < k) statements towards the end of the
function definition for matplot.

This is working as documented, although one might consider it an
infelicity in the implementation that it doesn't warn you that k is > 36
and suggest you pass your own set of plotting characters.

G

> 
> I hope this is clear, 
> 
> All the best, 
> 
> Anne
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



[Rd] bug using matplot (PR#10676)
Gavin Simpson