[R] Need help with xspline error message in R 2.6.1 on Windows XP

Anderson, Walter WAnderson at pbsj.com
Mon Jan 14 20:45:38 CET 2008

I am attempting to generate a series of plots with cubic B-Splines and
the code I am using is generating the following error message that I
have been unable to resolve.

Error in grid.Call.graphics("L_xspline", x$x, x$y, x$shape, x$open,
x$arrow,  :   add_point - reached MAXNUMPTS (25200)

This is the code that generates this error.

plot.results <- function(dfn) {
	dt <- read.table(dfn)
	shp <- rep(1, as.numeric(length(dt$year)))
	shp[1] <- shp[as.numeric(length(dt$year))] <- 0
	pushViewport(plotViewport(c(5.1, 4.1, 4.1, 2.1)))
	pushViewport(dataViewport(dt$year, dt$mean))
	grid.points(dt$year, dt$mean, pch=16)
	grid.xspline(dt$year, dt$mean, shape=shp, open=TRUE,


And here is the data that is being used:

  year  mean
1 2010  6738
2 2015  8793
3 2020 11699
4 2025 15951
5 2030 22492
6 2035 33289
7 2040 52917

I have tried changing the values in the shape vector and have noticed
that a value of 0 does not generate the error; however, it also does not
plot a line or curve.  I have also tried values for the shape vector of
-1, 0.1, 0.2, and 0.5.  

I think my problem may be unit related, but am unclear how to specify
that my control points are user units (or to convert user units to what
ever xspline might prefer).

Walter Anderson

More information about the R-help mailing list