Re: [R] Surface plotting

From: Duncan Murdoch <>
Date: Thu, 13 Nov 2008 10:27:42 -0500

On 11/13/2008 8:51 AM, mentor_ wrote:
> Hi,
> I would like to plot a matrix which comprises 3 columns.
> So first column should be the x-axis.
> Second the y-axis and the third one should be the z-axis.
> I know that I can plot such data using the scatterplot3d, but I would like
> to
> have a surface plot like you can do with wireframe and persp. But both,
> persp and wireframe,
> want to have x and y as descending data, at least persp. I am not sure but
> wireframe is actually
> doing excatly the same.
> So is there a way to plot each of the three columns on a different axis and
> having a surface?

You can do this in rgl, but not with data exactly as you describe. In the persp3d and surface3d functions, the x, y and z coordinates can be specified as in persp (z as a matrix, x and y as vectors labelling the rows and columns), but x and/or y can also be matrices. This is useful when the surface you're plotting isn't in the form z = f(x,y).

You can't really do it with vectors for all three without some convention saying which points form a quad on the surface.

Duncan Murdoch mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu 13 Nov 2008 - 15:29:54 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 13 Nov 2008 - 15:30:25 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive