surface

Low-level function that creates a surface object in the current axes.

Category: Graphics > 2-D and 3-D Plots

Syntax

surface(X, Y, Z)

Adds a surface to the current axes.

surface(X, Y, Z, C)

Colors it with C.

h = surface(___, Name, Value)

Sets properties and returns the handle.

Description

surface does not set the view the way surf does, and it is meant for building a figure piece by piece or adding a surface to existing graphics. Call view(3) yourself to see it from an angle.

Input arguments

X, Y, Z
Coordinates, as for surf.
C
Optional color data.

Output arguments

h
Handle of the new surface.

Example

Adding a surface by hand

[X, Y] = meshgrid(1:4);
h = surface(X, Y, X + Y);
view(3)
disp(class(h))
Output
matlab.graphics.chart.primitive.Surface

See also

surf patch mesh view