[R] xspline, graphical parameters and MAXNUMPTS

Paul Murrell p.murrell at auckland.ac.nz
Sun Dec 7 23:33:38 CET 2008


Hi


Keith Ponting wrote:
> Hello,
> 
> I am having two difficulties with xspline:
> 
> 1)      Passing lty=2 (via ...) appears to have no effect
>
> 2)      Apparently depending on the current plot axes, I may or may not
> get the failure: add_point - reached MAXNUMPTS (25200)


Both of these problems were bugs, which have now been fixed in the
development version of R.

Thanks for the report!

Paul


> This happens both on Linux/R 2.8.0 (details below) and Windows Vista/R
> 2.8.0 patched (2008-10-21 r46766)
> 
>  
> 
> Simplest case:
> 
> plot(c(0,1),c(0,1))
> 
> xspline(c(0,1),c(0,1)) # failure MAXNUMPTS
> 
> xspline(c(0,0.5,1),c(0,1,0),border=2,lty=2) # OK-ish, red, but no dashes
> 
>  
> 
> More complex case:
> 
> x <- c(-50.25, -50, -49.75, -0.75, -0.5, -0.25, 0.25, 0.5, 0.75, 49.75,
> 50, 50.25)
> 
> y <- c(0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1)
> 
> s <- c(1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1)
> 
> plot(c(0,1),c(0,1))
> 
> xspline(x,y,s,open=TRUE,repEnds=FALSE,border=2,lty=2) # fails MAXNUMPTS
> 
> points <-
> xspline(x,y,s,open=TRUE,repEnds=FALSE,border=2,lty=2,draw=FALSE) #fails
> MAXNUMPTS
> 
> plot(c(-50,50),c(0,1))
> 
> xspline(x,y,s,open=TRUE,repEnds=FALSE,border=2,lty=2) # OK-ish: red, but
> no dashes
> 
> points <-
> xspline(x,y,s,open=TRUE,repEnds=FALSE,border=2,lty=2,draw=FALSE) # works
> 
>  
> 
> I note from the help page that "Device coordinates are used (with an
> anisotropy correction if needed.)", so I assume the difference between
> the more complex cases which work and fail is to do with that, but I am
> stumped as  to how to use that information! (The only help message
> mentioning MAXNUMPTS I can find is to do with grid.xspline, so I cannot
> use the solution suggested there without recoding everything into grid.)
> 
>  
> 
> Thankyou,
> 
>  
> 
> Keith Ponting
> 
>  
> 
>  
> 
> R version 2.8.0 (2008-10-20)
> 
> Copyright (C) 2008 The R Foundation for Statistical Computing
> 
> ISBN 3-900051-07-0
> 
>  
> 
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> 
> You are welcome to redistribute it under certain conditions.
> 
> Type 'license()' or 'licence()' for distribution details.
> 
>  
> 
>   Natural language support but running in an English locale
> 
>  
> 
> R is a collaborative project with many contributors.
> 
> Type 'contributors()' for more information and
> 
> 'citation()' on how to cite R or R packages in publications.
> 
>  
> 
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 
> 'help.start()' for an HTML browser interface to help.
> 
> Type 'q()' to quit R.
> 
>  
> 
>> plot(c(0,1),c(0,1))
> 
>> xspline(c(0,1),c(0,1)) # failure MAXNUMPTS
> 
> Error in xspline(c(0, 1), c(0, 1)) :
> 
>   add_point - reached MAXNUMPTS (25200)
> 
>> xspline(c(0,0.5,1),c(0,1,0),border=2,lty=2) # OK-ish, red, but no
> dashes
> 
>> x <- c(-50.25, -50, -49.75, -0.75, -0.5, -0.25, 0.25, 0.5, 0.75,
> 49.75, 50, 50.25)
> 
> xspline(x,y,s,open=TRUE,repEnds=FALSE,border=2,lty=2) # fails MAXNUMPTS
> 
> points <-
> xspline(x,y,s,open=TRUE,repEnds=FALSE,border=2,lty=2,draw=FALSE) #fails
> MAXNUMPTS
> 
>> y <- c(0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1)
> 
>> s <- c(1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1)
> 
>> plot(c(0,1),c(0,1))
> 
>> xspline(x,y,s,open=TRUE,repEnds=FALSE,border=2,lty=2) # fails
> MAXNUMPTS
> 
> Error in xspline(x, y, s, open = TRUE, repEnds = FALSE, border = 2, lty
> = 2) :
> 
>   add_point - reached MAXNUMPTS (25200)
> 
>> points <-
> xspline(x,y,s,open=TRUE,repEnds=FALSE,border=2,lty=2,draw=FALSE) #fails
> MAXNUMPTS
> 
> Error in xspline(x, y, s, open = TRUE, repEnds = FALSE, border = 2, lty
> = 2,  :
> 
>   add_point - reached MAXNUMPTS (25200)
> 
>> plot(c(-50,50),c(0,1))
> 
>> xspline(x,y,s,open=TRUE,repEnds=FALSE,border=2,lty=2) # OK-ish: red,
> but no dashes
> 
>> points <-
> xspline(x,y,s,open=TRUE,repEnds=FALSE,border=2,lty=2,draw=FALSE) # works
> 
>> sessionInfo()
> 
> R version 2.8.0 (2008-10-20)
> 
> x86_64-unknown-linux-gnu
> 
>  
> 
> locale:
> 
> LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.U
> TF-8;LC_MONETARY=C;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_NAME=
> C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATI
> ON=C
> 
>  
> 
> attached base packages:
> 
> [1] stats     graphics  grDevices utils     datasets  methods   base
> 
>> Sys.info()[c(1:3,5)]
> 
>                               sysname
> release
> 
>                               "Linux"
> "2.6.18.2-34-default"
> 
>                               version
> machine
> 
> "#1 SMP Mon Nov 27 11:46:27 UTC 2006"
> "x86_64"
> 
>  
> 
> Keith Ponting
> 
> Aurix Ltd, Malvern WR14 3SZ  UK
> 
>  
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/



More information about the R-help mailing list