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

From: Anderson, Walter <WAnderson_at_pbsj.com>
Date: Mon, 14 Jan 2008 14:45:38 -0500


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
	grid.rect()
	pushViewport(plotViewport(c(5.1, 4.1, 4.1, 2.1)))
	pushViewport(dataViewport(dt$year, dt$mean))
	grid.rect()
	grid.xaxis()
	grid.yaxis()
	grid.points(dt$year, dt$mean, pch=16)
	grid.xspline(dt$year, dt$mean, shape=shp, open=TRUE,
gp=gpar(col="red"))
	popViewport(2)

}

plot.results("section01_model_results.dat")

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



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. Received on Mon 14 Jan 2008 - 19:47:37 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 14 Jan 2008 - 21:30:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive