e-mail athula.herath
2012-Mar-02 06:32 UTC
[R] 3d surface plot (ideally using rgl package)?
Dear HelpeRs, I would be grateful for anybody who might help to produce the following plot (the code for matlab is below) using the "rgl" package of R? [t,r] = meshgrid(linspace(0,2*pi,361),linspace(-4,4,101)); [x,y] = pol2cart(t,r); P = peaks(x,y); figure('color','white'); polarplot3d(P,'colordata',gradient(P)); view([-18 72]); You may see the code and plot output at: https://plus.google.com/u/0/109789409461372488563/posts/YfcrsMhkjyf Many Thanks A. [[alternative HTML version deleted]]
R. Michael Weylandt
2012-Mar-02 13:27 UTC
[R] 3d surface plot (ideally using rgl package)?
It is by no means clear what the "peaks" function does or if it has any R equivalent, but perhaps looking at demo(rgl) will get you started. After that, you should probably show what you've tried (at least as far as replicating the calculation aspects). Michael On Fri, Mar 2, 2012 at 1:32 AM, e-mail athula.herath <athula.herath at ntlworld.com> wrote:> Dear HelpeRs, > > I would be grateful for anybody who might help to produce the following > plot (the code for matlab is below) using the "rgl" package of R? > > [t,r] = meshgrid(linspace(0,2*pi,361),linspace(-4,4,101)); > [x,y] = pol2cart(t,r); > P = peaks(x,y); > figure('color','white'); > polarplot3d(P,'colordata',gradient(P)); > view([-18 72]); > > You may see the code and plot output at: > > https://plus.google.com/u/0/109789409461372488563/posts/YfcrsMhkjyf > > Many Thanks > > A. > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > 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.