Dear R users -- I think this question was asked before but there was no reply to it. I would appreciate any suggestion any of you might have. I am interested in plotting several "implicit functions" (F(x,y,z)=0) on the same fig. Is there anyone who has an example code of how to do this? Thank you Yihsu
The answer I have seen before on this list (but cannot find at the moment) was a suggestion to solve for one of the variables in terms of the other two and then plot with standard 3d plotting routines. I also seem to remember that some of the examples in an RGL vignette had examples of graphed "implicit functions". I call them parametric fucntions, but that term is used in so many other ways that prevent effective searching. Searching on "rgl parametric function" produced this possibly relevant hit (among others): http://finzi.psych.upenn.edu/R/library/misc3d/html/parametric3d.html -- David Winsemius On Dec 11, 2008, at 12:57 PM, YIHSU CHEN wrote:> Dear R users -- > > I think this question was asked before but there was no reply to it. > I would appreciate any suggestion any of you might have. I am > interested in plotting several "implicit functions" (F(x,y,z)=0) on > the same fig. Is there anyone who has an example code of how to do > this? > > Thank you > > Yihsu > > ______________________________________________ > 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.
YIHSU CHEN-3 wrote:> > Dear R users -- > > I think this question was asked before but there was no reply to it. > I would appreciate any suggestion any of you might have. I am > interested in plotting several "implicit functions" (F(x,y,z)=0) on > the same fig. Is there anyone who has an example code of how to do > this? > > Thank you > > Yihsu > > If almost one of the variables are explicitable, you can use maxima plot3d > function in this form: > > plot3d([fx,fy,fz],[x,xmin.xmax],[y,ymin,ymax],['grid,50,15]); > > i.e: > > if you have this function: > x=(z^2/(127*(y+0.325-3.4*10^(-3)*z+1.2*10^(-5)*z^2))), you'll be able to > explicitly write x or y, but not z; in this case you won't be able to plot > in the right way the 3dimensional plot with standard use of plot3d. In > order to do it correctly, use the command above in that form, so that: > > > plot3d([z^2/127*(y+0.325-3.4*10^(-3)*z+1.2*10^(-5)*(z^2)),y,z],[y,0,0.08],[z,0,400],['grid,50,15]); > > parametric3d() function of R is the same thing! > > > > ______________________________________________ > 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. > >-- View this message in context: http://www.nabble.com/how-to-plot-implicit-functions-tp20961172p21175593.html Sent from the R help mailing list archive at Nabble.com.
If you are lucky, try draw3d function of maxima: (http://www.telefonica.net/web2/biomates/maxima/gpdraw/) load(draw); draw3d(implicit(2=(cos(x+%phi*y)+cos(x-%phi*y)+cos(y+%phi*z)+cos(y-%phi*z)+cos(z-%phi*x)+cos(z+%phi*x)),x,-4,4,y,-4,4,z,-4,4), enhanced3d = true, palette = gray, surface_hide = true)$ Many times this function fails; this is due to the fact that resolving non-linear polynomial equations is required in order to plot 3d-graph, and sometimes machines, with their finite-number idea, are not able to do it. -- View this message in context: http://www.nabble.com/how-to-plot-implicit-functions-tp20961172p21175791.html Sent from the R help mailing list archive at Nabble.com.
YIHSU CHEN wrote:> Dear R users -- > > I think this question was asked before but there was no reply to it. > I would appreciate any suggestion any of you might have. I am > interested in plotting several "implicit functions" (F(x,y,z)=0) on > the same fig. Is there anyone who has an example code of how to do > this?The misc3d package has a contour3d function that could draw a contour of the function F at level 0. Assuming you have written a function to calculate F and know the region where you want to plot it, you could just say contour3d(F, 0, seq(minx, maxx, 30), seq(miny, maxy, 30), seq(minz, maxz, 30)) Duncan Murdoch