[Rd] ugly plots with xlim/ylim exceeding data range (changed since R2.6.1)

Sklyar, Oleg (London) osklyar at maninvestments.com
Wed Sep 3 14:47:56 CEST 2008


The behaviour of the plot function when used with xlim/ylim and the
matplot function as in the following simple example changed between
R2.6.1 and 2.7.0+ producing ugly plots in the new versions. In case of
plot it looks like the pretty function is called with wrong arguments
(i.e. range of supplied data rather than values of xlim and ylim):

m = matrix(c(-0.033, 0.009, 0.064, 0.050, 0.097,
    -0.008, 0.037, 0.070, 0.060, 0.077,
    -0.027, 0.051, 0.060, 0.106, 0.049,
    -0.068, -0.009, 0.095, 0.091, 0.125,
    -0.065, 0.013, 0.062, 0.111, 0.080), ncol=5, byrow=TRUE)

pdf(sprintf("R2.%s_SVN_%s.pdf", version$minor, version$"svn rev"))
plot(c(-5,5),c(0,10),xlim=c(-10,10),ylim=c(-5,15))
matplot(m)
dev.off()

I attached three PDFs with the outputs from R2.6.1 (43537) (which I
consider to be correct), R2.7.2 patched (46442) and R2.8.0 (46234). Just
in case PDFs are removed by the mail server here is the description of
the problem: the one from R2.6.1 plots the axes correctly putting ticks
along the whole axis range even if the data fits just the part of the
range; the ones from 2.7.2 and 2.8.0 put ticks just for the part of the
axis range. In case of plot they cover the range of the data, but with
the requested xlim and ylim they should cover the range of those, and in
case of matplot the range of ticks does not cover the range of data at
all.

Here are the seesionInfo's:

-----------------------------------------------------------------
R version 2.8.0 Under development (unstable) (2008-08-05 r46234) 
x86_64-unknown-linux-gnu 

locale:
C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

-----------------------------------------------------------------
R version 2.7.2 Patched (2008-08-26 r46442) 
x86_64-unknown-linux-gnu 

locale:
C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base 

-----------------------------------------------------------------
R version 2.6.1 (2007-11-26) 
x86_64-unknown-linux-gnu 

locale:
C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base


loaded via a namespace (and not attached):
[1] rcompgen_0.1-17


Dr Oleg Sklyar
Technology Group
Man Investments Ltd
+44 (0)20 7144 3803
osklyar at maninvestments.com


**********************************************************************
The contents of this email are for the named addressee(s) only.
It contains information which may be confidential and privileged.
If you are not the intended recipient, please notify the sender
immediately, destroy this email and any attachments and do not
otherwise disclose or use them. Email transmission is not a
secure method of communication and Man Investments cannot accept
responsibility for the completeness or accuracy of this email or
any attachments. Whilst Man Investments makes every effort to keep
its network free from viruses, it does not accept responsibility
for any computer virus which might be transferred by way of this
email or any attachments. This email does not constitute a request,
offer, recommendation or solicitation of any kind to buy, subscribe,
sell or redeem any investment instruments or to perform other such
transactions of any kind. Man Investments reserves the right to
monitor, record and retain all electronic communications through
its network to ensure the integrity of its systems, for record
keeping and regulatory purposes. 

Visit us at: www.maninvestments.com

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



More information about the R-devel mailing list