2D image in 3D plot with partial transparency

2 次查看(过去 30 天)
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 :(

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by