In MATLAB
Below is an approach that uses the meshgrid()
function to create a domain for the Temperature
to be plotted on/against. To plot a 2D heat-map we can use surf()
and set the elevation to a top view (90 degrees) by using the view()
function. Depending if you wish to have interpolation or not the use of shading interp
can be included or removed. To get the time labels we can convert the Time_Vector
to a string array and use an arrayfunc()
(array function) to replace the dot, .
with a colon, :
. Lastly we can use the set()
function on the current axis, gca
to display the newly formatted time labels on the plot. The colormap()
can be set to a variety of options such as 'hot'
, 'winter'
, 'spring'
, etc.
Time_Vector = (10.00: 0.01: 10.09);
Depth_Vector = (1:3);
Temperature = [15 16 17 18 19 20 20 20 20 20;
25 30 35 40 45 50 50 50 50 50;
30 35 40 45 50 55 60 65 70 75];
[Time_Grid,Depth_Grid] = meshgrid(Time_Vector,Depth_Vector);
surf(Time_Grid,Depth_Grid,Temperature);
title("Heatmap");
xlabel("Time"); ylabel("Depth");
colormap(hot);
shading interp
Angle = 0; Elevation = 90;
view(Angle,Elevation);
colorbar;
%Time label adjustments%
Time_Labels = string(Time_Vector);
Time_Labels = arrayfun(@(x) replace(x,".",":"),Time_Labels);
set(gca,'xtick',Time_Vector,'xticklabel',Time_Labels);
Ran using MATLAB R2019b
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…