How to plot this colormap correctly?

I am trying to plot a heat map of temperature along depth and time. However the plot does not match the provided data. For instance at z = -8612 m I have T = 80.57°C, but it would be something near 165°C.
I attached my .mat files, the depth, time and temperature data. My code to plot is:
% Plotting
figure;
imagesc(time, depth, temp);
colormap('jet');
colorbar;
xlabel('Time');
ylabel('Depth');
title('Temperature Heat Map');
set(gca, 'YDir', 'normal');
Could someone please give me any idea of what is happening here?
Thanks!

 采纳的回答

The difference between adjacent elements of depths is not constant. (Same for time.)
load depth
load temp
load time
% difference between adjacent elements of depths:
disp(diff(depths.'))
Columns 1 through 33 -211 -200 -190 -180 -170 -160 -150 -140 -130 -120 -110 -100 -90 -80 -70 -60 -50 -40 -30 -20 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 Columns 34 through 66 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 Columns 67 through 99 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 Columns 100 through 132 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 Columns 133 through 165 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -20 -30 -40 -50 -60 -70 -80 -90 -100 -110 -120 -130 -140 -150 -160 -170 -180 -190 -200 -210 -220 -230 -240 Columns 166 through 170 -250 -260 -270 -280 -292
An image uses equally-sized pixels, so it's not an appropriate choice to represent data like this where the x- and y- spacing is not constant.
Better is to use a surface:
surface(time, depths, temperature, 'EdgeColor', 'none')
xlim(time([1 end]))
ylim(depths([end 1]))
colormap('jet');
colorbar;
xlabel('Time');
ylabel('Depth');
title('Temperature Heat Map');
set(gca, 'YDir', 'normal');

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Blue 的更多信息

产品

版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by