How to overlay a surf plot with a 2D matrix

8 views (last 30 days)
Hi all,
I have a 3D matrix (300x178x125) describing the surface of a glacier, which is plotted with the slice command:
clear all
load('glacier.mat')
load('realx.mat')
load('realy.mat')
load('realz.mat')
load('h_deb.mat')
length = 50;
c1 = [204, 255, 255]/255;
c2 = [130, 200, 255]/255;
colors_p = [linspace(c1(1),c2(1),length)', linspace(c1(2),c2(2),length)', linspace(c1(3),c2(3),length)'];
glacier = double(squeeze(glacier));
glacier(glacier==0)=nan; % added line
h = slice(realx,realy,realz,glacier, [], [], 1:size(glacier,1));
set(h, 'EdgeColor','none', 'FaceColor','interp', 'FaceLighting','gouraud')
colormap(colors_p)
colorbar;
xlim([1000 3000])
ylim([0 6000])
zlim([0 125])
caxis([0 40])
daspect([0.5 1 0.1])
view(-142,31)
set(gcf, 'color', 'white')
which then looks like this:
I now want to overlay a 2D matrix (300x178) on the surface of the glacier:
How can I overlay the 2D matrix on top of the glacier surface with 0 put to transparant?
Thanks already
  2 Comments
Yoni Verhaegen -WE-1718-
Yoni Verhaegen -WE-1718- on 25 Jun 2022
@Adam Danz Yes that is correct! I added the corresponding matrices in attachment in case this would make my question clearer. The matrix h_deb is what I would like to show on top of the glacier surface.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by