isocolors
Computes the colors of isosurface vertices from a second volume of data.
Category: Graphics > 2-D and 3-D Plots
Syntax
cdata = isocolors(X, Y, Z, C, verts)
Interpolates the volume C at the vertices verts.
cdata = isocolors(C, verts)
Uses the grid 1:n in each direction.
isocolors(___, p)
Sets the colors of the patch p directly.
Description
The shape of an isosurface comes from one variable, but you may want to color it by another, such as temperature over a pressure surface. isocolors samples that second volume at each vertex by interpolation. Assign the result to the FaceVertexCData property of the patch.
Input arguments
X, Y, Z- Coordinate arrays of the volume.
C- 3-D array of color values, or an
m-by-n-by-p-by-3 array of RGB values. vertsn-by-3 matrix of vertices, typicallyfv.verticesfromisosurface.
Output arguments
cdata- One color value per vertex: a column vector for scalar data, or
n-by-3 for RGB data.
Example
Color by a second field
[x, y, z] = meshgrid(-1:0.5:1);
v = x.^2 + y.^2 + z.^2;
fv = isosurface(x, y, z, v, 0.5);
c = isocolors(x, y, z, x, fv.vertices);
size(c)
min(c), max(c)
Output
ans = 1×2
74 1
ans = -0.6667
ans = 0.6667