Karl Knoblick
2011-Oct-31 22:11 UTC
[R] 3D Graph Surface and single points (eg wireframe with points)
Hallo! ? I just want to make a 3D plot of a surface of a cone and want to plot some single points around. ? I tried wireframe but cannot find how to plot single points ? I tried scatterplot3d but there the surface is not simple to plot. And: How can I rotate the point of view by the z-axis ? I tried persp3d but how can I add some single points? ? Example: ? library(lattice) library(scatterplot3d) #data d <- expand.grid(x = 1:10, y = 5:15) d$z <- sqrt((d$x-4)^2 + (d$y-10)^2) wireframe(z ~ x * y, data = d, drape=T) # How to plot points?? ????????????? scatterplot3d(d$x, d$y, d$z) # How to plot nice surface? # How to rotate point of view by z axis? # BTW: points3d should add some points (does not work for me) # persp3d no example ? ? Can anybody help? Has anybody such an example? ? Actually, I think it is possible with R to dray such 3D plots - the question is how? Even possible to animate the 3D plot? Or rotate interactive? ? ? Best regards Karl
Duncan Murdoch
2011-Oct-31 23:16 UTC
[R] 3D Graph Surface and single points (eg wireframe with points)
On 11-10-31 6:11 PM, Karl Knoblick wrote:> Hallo! > > I just want to make a 3D plot of a surface of a cone and want to plot some single points around. > > I tried wireframe but cannot find how to plot single points > > I tried scatterplot3d but there the surface is not simple to plot. And: How can I rotate the point of view by the z-axis > > I tried persp3d but how can I add some single points?After drawing the surface with persp3d, just use points3d to add the points. You say it didn't work for you, but you don't show what you did, so I have no idea what went wrong. Duncan Murdoch> > Example: > > library(lattice) > library(scatterplot3d) > > #data > d<- expand.grid(x = 1:10, y = 5:15) > d$z<- sqrt((d$x-4)^2 + (d$y-10)^2) > > wireframe(z ~ x * y, data = d, drape=T) > # How to plot points?? > > scatterplot3d(d$x, d$y, d$z) > # How to plot nice surface? > # How to rotate point of view by z axis? > # BTW: points3d should add some points (does not work for me) > > # persp3d no example > > > Can anybody help? Has anybody such an example? > > Actually, I think it is possible with R to dray such 3D plots - the question is how? Even possible to animate the 3D plot? Or rotate interactive? > > > Best regards > Karl > > ______________________________________________ > 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.