[R] How to plot Ellipsoid like function
Duncan Murdoch
murdoch.duncan at gmail.com
Mon Dec 13 16:20:50 CET 2010
On 13/12/2010 10:13 AM, Uwe Wolfram wrote:
> Dear R-Users,
>
> I am currently trying to fit a tensorial function in its principal
> coorinate system. The function is given by:
>
> 1~(x1^2 + x2^2 + x3^2 - chi0*(x1*x2 + x1*x3 + x2*x3))/eps0^2 + (x1 + x2
> + x3)/xi0
>
> Where eps0 = 0.0066, chi0 = -0.66 and xi0 = 0.011 are obtained from
> experimental data using nls().I am able to plot the experimental points
> that delivered the parameters of the function. For my thesis, however, I
> need to overlay the fitted surface. So far I am using the following code
> which wonderfully plots the experimental points in 3D:
>
> ===================================================================
> # from demo(bivar)
> require(rgl)
> require(misc3d)
> require(MASS);
>
> # New window
> open3d()
> # clear scene:
> clear3d("all")
> # setup env. That is, background, light and so on:
> bg3d(color="#887777")
> light3d()
> # spheres at points in principal strain space
> #spheres3d(e1,e2,e3,radius=0.00025,color="#CCCCFF")
> # draws points alternatively
> plot3d(e1,e2,e3, col="#CCCCFF")
> ===================================================================
>
> According to the examples on http://rgl.neoscientists.org/gallery.shtml
> I tried to overlay the point plot using surface3d. However, these were
> only functions of type y ~f(x1, x2). I think that the surface could be
> plotted if I could provide the gridpoints correctly. Using
> xyz.coords(1~(x1^2 + x2^2 + x3^2 - chi0*(x1*x2 + x1*x3 + x2*x3))/eps0^2
> + (x1 + x2 + x3)/xi0, y = NULL, z = NULL) did unfortunately not solve
> the problem.
>
> Is there any function that can generate the surface for the given
> function such as ContourPlot3D in Mathematica.
See ?misc3d::contour3d
More information about the R-help
mailing list