MATLAB: Alpha mapping using ‘surf’

alphaalphadataalphamappingopacitysurftransparency

Hey,
I'm trying to make part of a surface, created using the 'surf' function, transparent. Its a 300×300 image that is surfed as following:
% --- AZ-PLANE ---
Y = linspace(-boxSize/2, boxSize/2, viewInf.resolution);
Z = linspace(0, boxSize, viewInf.resolution);
Y = repmat(Y , [viewInf.resolution 1]);
Z = repmat(Z', [1 viewInf.resolution]);
X = xPush*ones(viewInf.resolution);
% Draw plane
azSurf = surf(X,Y,Z, azPlane.Image);
% Set properties
set(azSurf, 'EdgeColor', 'none');
Since some of the values are NaN, they are already transparent, but i need more than that. The code below has a constant alpha map, but that's just for testing purposes, its gonna be changed later on. The alpha map is made and applied like this
alphaMapAz = 0.1*ones(size(azPlane.Image));
set(azSurf, 'AlphaData', alphaMapAz, 'AlphaDataMapping', 'none');
Yet no transparency occurs. What the duck am I doing wrong here?

Best Answer

From the MWE add
set(azSurf, 'FaceAlpha', 'flat');
you may also want to look at
doc alpha