|On this page…|
An alphamap is simply an array of values ranging from 0 to 1. The size of the array can be either m-by-1 or 1-by-m.
The default alphamap contains 64 values ranging linearly from 0 to 1, as you can see in the following plot.
This alphamap displays the lowest alpha data values as completely transparent and the highest alpha data values as opaque.
The alphamap function creates some useful predefined alphamaps and also enables you to modify existing maps. For example,
produces the following alphamap.
You can shift the values using the increase or decrease options. For example,
adds the value .4 to all values in the current figure's alphamap. Replotting the 'vup' alphamap illustrates the change. The values are clamped to the range [0 1].
This example uses slice planes to examine volume data. The slice planes use the color data for alpha data and employ a rampdown alphamap (the values range from 1 to 0):
[x,y,z] = meshgrid(-1.25:.1:-.25,-2:.2:2,-2:.1:2); v = x.*exp(-x.^2-y.^2-z.^2);
h = slice(x,y,z,v,[-1 -.75 -.5],,); alpha('color') set(h,'EdgeColor','none','FaceColor','interp',... 'FaceAlpha','interp')
alphamap('rampdown') alphamap('increase',.1) colormap(hsv)
This alphamap causes the smallest values of the function (around zero) to be displayed with the least transparency and the greatest values to display with the most transparency. This enables you to see through the slice planes, while at the same time preserving the data around zero.