2D image in 3D plot with partial transparency

1 view (last 30 days)
I used surf to plot a 2D matrix as a 3D model, then I want to place imagesc(matrix) on top of this 3D model.Moreover, I want to set part of the 2D image transparent. I understand the texturemap trick, but such method doesn't allow me to set alpha data to my 2D image. Any suggestion, many thanks.
surf(sampleMatrix); hold on
xLimit = xlim;
yLimit = ylim;
alphaMap = zeros(size(sampleMatrix));
alphaMap(:) = 0.5;
alphaMap(sampleMatrix == 5) = 0;
surf([xLimit(1) xLimit(2)],[yLimit(1) yLimit(2)],repmat(70, [2 2]),...
sampleMatrix, 'Facecolor','texturemap', 'alphadata', alphaMap);
The last line doesn't work :(

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!