Documentation Center

  • Trial Software
  • Product Updates

Selecting an Alphamap

What Is an Alphamap?

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].


Example — Modifying the Alphamap

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):

  1. Create the volume data by evaluating a function of three variables.

    [x,y,z] = meshgrid(-1.25:.1:-.25,-2:.2:2,-2:.1:2);
    v = x.*exp(-x.^2-y.^2-z.^2);
  2. Create the slice planes, set the alpha data equal to the color data, and specify interpolated FaceAlpha.

    h = slice(x,y,z,v,[-1 -.75 -.5],[],[0]);
  3. Install the rampdown alphamap and increase each value in the alphamap by .1 to achieve the desired degree of transparency. Specify the hsv colormap.


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.

Was this topic helpful?