Error in calcCurveGrob(x, x$debug) : End points must not be identical
Hi
Bryan Hanson wrote:
Hi All... I haven?t found mention of this error anywhere. I'm trying to draw spline curves using grid graphics. Most of the time, I have no problems, but I have some data sets that give the error in the subject line. I'm not sure which end points are identical, but the end points passed to the function are definitely not identical.
I get ...
which(tst$x.st == tst$x.end & tst$y.st == tst$y.end)
[1] 11 14
Also, the viewport you have set up will not show any of the curves
because its "native" scale is 0 to 1. The following at least makes the
curves visible ...
grid.newpage()
vp <- viewport(width = 0.9, height = 0.9, x = 0.5, y = 0.5,
xscale=c(-10, 10), yscale=c(-15, 15))
pushViewport(vp)
grid.rect(gp = gpar(lty = "dashed", col = "gray"))
grid.points(0.5, 0.5, pch = 20, gp = gpar(cex = 0.5))
subset <- -c(11, 14)
grid.curve(tst$x.st[subset], tst$y.st[subset],
tst$x.end[subset], tst$y.end[subset],
default.units = "native")
Paul
p.s. Intrigued to know what sort of image you are producing, if you are
able to share.
Any assistance appreciated! Bryan
tst <-
structure(list(x.st = c(-1, -2, -3, -1, -1.5, -3, -1.5, -1.5,
-8, -1, -1.5, -1, -1.5, -2, -1.5, -2, -1, -1.5, -2), y.st =
c(1.73205080756888,
3.46410161513776, 5.19615242270663, 1.73205080756888, 2.59807621135332,
5.19615242270663, 2.59807621135332, 2.59807621135332, 13.8564064605510,
1.73205080756888, 2.59807621135332, 1.73205080756888, 2.59807621135332,
3.46410161513776, 2.59807621135332, 3.46410161513776, 1.73205080756888,
2.59807621135332, 3.46410161513776), x.end = c(-6.5, -6.5, -6.5,
-4, -4, -4, -1.5, -1, -1, -1.5, -1.5, -2, -2, -2, -3, -3, -8,
-8, -8), y.end = c(-11.2583302491977, -11.2583302491977, -11.2583302491977,
-6.92820323027551, -6.92820323027551, -6.92820323027551, -2.59807621135332,
1.73205080756888, 1.73205080756888, 2.59807621135332, 2.59807621135332,
3.46410161513776, 3.46410161513776, 3.46410161513776, 5.19615242270663,
5.19615242270663, 13.8564064605510, 13.8564064605510, 13.8564064605510
), grp = c(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3), lwd = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, 1,
2, 5, 2)), .Names = c("x.st", "y.st", "x.end", "y.end", "grp",
"lwd"), row.names = 34:52, class = "data.frame")
grid.newpage()
vp <- viewport(width = 0.9, height = 0.9, x = 0.5, y = 0.5)
pushViewport(vp)
grid.rect(gp = gpar(lty = "dashed", col = "gray"))
grid.points(0.5, 0.5, pch = 20, gp = gpar(cex = 0.5))
grid.curve(tst$x.st, tst$y.st, tst$x.end, tst$y.end,
default.units = "native")
#######
sessionInfo()
R version 2.12.0 (2010-10-15) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] datasets tools grid grDevices graphics utils [7] stats methods base other attached packages: [1] gridExtra_0.7 GGally_0.2.2 xtable_1.5-6 [4] mvbutils_2.5.1 ggplot2_0.8.8 proto_0.3-8 [7] reshape_0.8.3 ChemoSpec_1.46 seriation_1.0-2 [10] colorspace_1.0-1 TSP_1.0-1 R.utils_1.5.3 [13] R.oo_1.7.4 R.methodsS3_1.2.1 rgl_0.92.794 [16] lattice_0.19-13 mvoutlier_1.4 plyr_1.2.1 [19] RColorBrewer_1.0-2 chemometrics_1.0 som_0.3-5 [22] robustbase_0.5-0-1 rpart_3.1-46 pls_2.1-0 [25] pcaPP_1.8-3 mvtnorm_0.9-92 nnet_7.3-1 [28] mclust_3.4.6 MASS_7.3-8 lars_0.9-7 [31] gclus_1.3 cluster_1.13.1 e1071_1.5-24 [34] class_7.3-2
______________________________________________ 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/