Skip to content

surf

3D surface plot with colored faces.

h = surf(Z)
h = surf(X, Y, Z)
h = surf(X, Y, Z, C, ...)

Renders a 3D parametric surface from (X, Y, Z) grid data. With only Z, uses the row/column indices as X and Y. Optional C provides per-vertex color values; without C, the surface is colored by Z.

[X, Y] = meshgrid(-3:0.1:3);
Z = peaks(X, Y);
surf(X, Y, Z)
  • mesh — 3D mesh (wireframe) plot.
  • surfc — 3D surface plot with contour lines projected on the floor.
  • surfl — 3D surface plot with lighting.
  • pcolor — Pseudocolor plot — flat 2D colored grid.
  • waterfall — 3D waterfall plot — independent line traces along one dimension.