How to overlay a surf plot with a 2D matrix
8 views (last 30 days)
Show older comments
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
Answers (0)
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!