[R] Plot z=f(x,y) analytically

David L Carlson dcarlson at tamu.edu
Wed Aug 19 20:16:35 CEST 2015


You probably want function persp3d() in package rgl. You have to define the formula as a function and specify the limits correctly, but you were close:

> library(rgl)
> persp3d(function(x, y) x^2+y^2, xlim=c(-3, 3), ylim=c(-3, 3))

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352


-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of chappo007
Sent: Wednesday, August 19, 2015 6:48 AM
To: r-help at r-project.org
Subject: [R] Plot z=f(x,y) analytically

Hi,

I've been led to believe that in R  it is possible to produce a 3d
analytical plot of a function.  I've been pointed in the direction of
plot3d(), so the command is something like
plot3d(x^2+y^2,(x,-3,3),(y,-3,3)).  And a smart person out there is going to
tell me where this syntax comes from (or belongs to), there is also a R
package called MapleSoft ( I believe) which is commercial, and there is
always Mathematica.  So is there a R function to plot z=f(x,y) without
obtain or generating data.

Cheers,
Mike



--
View this message in context: http://r.789695.n4.nabble.com/Plot-z-f-x-y-analytically-tp4711272.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.



More information about the R-help mailing list