[R] Is there a way to draw 3d plot?

Greg Snow Greg.Snow at intermountainmail.org
Fri May 26 16:58:56 CEST 2006


There is also the rotate.persp function in the TeachingDemos package.
It creates a set of slider bars that you can move with the mouse to
change the different options to persp including the angles.  It is not
quite as convenient as clicking in the plot and dragging like rgl
allows, but it does have the advantage that when you have the plot you
like, you can see what the current settings are and recreate the same
plot using persp and those settings rather than having to remember how
you rotated the graph interactively (you can query the current rotation
in rgl as well and set it by command in future plots). 


-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111
 

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Michael
Sent: Friday, May 26, 2006 1:25 AM
To: Uwe Ligges
Cc: R-help at stat.math.ethz.ch
Subject: Re: [R] Is there a way to draw 3d plot?

On 5/26/06, Uwe Ligges <ligges at statistik.uni-dortmund.de> wrote:
>
> Michael wrote:
>
> > Hi all,
> >
> > I have a 2D matrix, which has 100 rows, and 100 columns,
> >
> > I have a 2D matrix, with 100 rows and 100 columns,
> >
> > I want to display it using 3D plot, much like plot3d and mesh/surf
> functions
> > in matlab.
> >
> > Specifically, in matlab, I just need to do the following:
> >
> > --------
> > [X, Y]=meshgrid([0:0.01:0.99, 0:0.01:0.99]); % Z is my 2D matrix, 
> > surf(X, Y, Z);
> > --------
> >
> > Note that X and Y are created so that I can associate physical 
> > meaning
> onto
> > the x and y axis of the 3D plot.
> >
> > For example, my 100 rows represent 0, 0.01, 0.02, ... 0.99 here.
> >
> > In Matlab I can also drag in the graphic window and see from 
> > different visual angle and perspective of the 3D plot...
> >
> > Are there similar functions in R that (1) show 3D plot; (2) let me 
> > manipulate view angles easily?
>
> (1) See ?persp
>
> (1) *and* (2): See package "rgl".
>
> Uwe Ligges
>
>
>
> Thanks a lot,

But a glance at "rgl" seems requireing "shape", etc... and very
complicated...

Any easier approaches?

"persp" does not allow me to use mouse to rotate....

	[[alternative HTML version deleted]]

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html



More information about the R-help mailing list