3-D Visualization | ![]() ![]() |
Example: Mapping Data to Color or Transparency
This example displays a surface plot of a functions of two variables. The color is mapped to the gradient of the z
data.
[x,y] = meshgrid([-2:.2:2]); z = x.*exp(-x.^2-y.^2); surf(x,y,z,gradient(z)); axis tight
You can map transparency to the gradient of z
in a similar way.
surf(x,y,z,'FaceAlpha','flat',... 'AlphaDataMapping','scaled',... 'AlphaData',gradient(z),... 'FaceColor','blue'); axis tight
![]() | Mapping Data to Transparency | Selecting an Alphamap | ![]() |