[R] How to create surface3d plot with surface data
nguyen.hoang at jvn.edu.vn
Tue May 21 07:43:40 CEST 2013
WIth x, y are vectors, the grid is plotted by surface3d. Thanks for your
My code is here;
#SurfacePlot is plotted by above surface data
Surface <- read.csv("D:/R/Surface.csv", header=F)
Surface <- as.matrix(Surface)
x <- Surface[2:17,1]
x <- as.numeric(x) # x is vector 1x16
y <- Surface[1,2:11]
y <- t(y)
y <- as.numeric(y) #y is vector 1x10
z <- Surface[2:17,2:11] # z is matrix 16x10
plot3d(ScatterPlot$x1, ScatterPlot$y1, ScatterPlot$z1,
xlab="x",ylab="y",zlab="z", type="s", col = "blue", size=0.25, lit=FALSE)
# ScatterPlot is showed as below data.
I combined surface3d and plot3d() in graph.
And now, I want to add line segments showing the error between points of
scatter plot and grid of surface3d.
X1 Y1 Z1
1 25000.030 0.001218202 0.1915856
2 5118.15450 0.061169029 0.4711610
3 17005.82875 0.007177435 0.3222662
4 5300.22698 0.029688212 0.2770485
I think I should build linear model to predict z1_new values from x1 & y1
based on Surface data, And use spheres3d() to plot points of Scatterplot on
surface grid, and then use segment3d() to add line segments between points
of scatter plot and grid of surface3d coordinate.
But. i don't know to do that. What should I do? my method is true ?
View this message in context: http://r.789695.n4.nabble.com/How-to-create-surface3d-plot-with-surface-data-tp4667483p4667555.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help