2D image in 3D plot with partial transparency

1 回表示 (過去 30 日間)
Kyle Wang
Kyle Wang 2015 年 4 月 2 日
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 Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by