How to draw a semi-circular heat map?(怎么画半圆形的热力图)

5 次查看(过去 30 天)
How to draw such a heatmap, should I use 'polaroplot' or 'colormap'?
怎么画出这样的热力图,应该使用polarplot还是colormap?

回答(1 个)

Star Strider
Star Strider 2024-8-11
编辑:Star Strider 2024-8-11
The general approach would be to create a rectangular array first, and then use the cart2pol function to create it as a semicircular area.
Example —
a = linspace(0, pi, 80); % Angle Vector
r = linspace(0, 12, 24); % Radius Vector
[A,R] = ndgrid(a,r); % Corresponding Matrices
Z = ones(size(A))*0.1; % 'Z' Is Initially Flat
% Z(10:20,10:15) = 2+exp(-(Z(10:20,10:15)-50).^2*5); % Create 'Prominence' In 'Z'
for k = 1:10
Z(10+k,(2:3)+2*k) = 2+exp(-(Z(10+k,(2:3)+2*k)-10*rand).^2*500); % Create 'Prominence' In 'Z'
end
figure
surf(A,R,Z, 'EdgeColor','interp', 'FaceColor','interp')
xlabel('Angle')
ylabel('Radius')
title('Rectangular Array')
clim([-0.01 1.8])
colormap(turbo)
colorbar
[X,Y,Z] = pol2cart(A,R,Z);
figure
surf(X,Y,Z, 'EdgeColor','interp', 'FaceColor','interp')
axis('equal')
clim([-0.01 1.8])
colormap(turbo)
colorbar
title('Polar Surface')
figure
surf(X,Y,Z, 'EdgeColor','interp', 'FaceColor','interp')
axis('equal')
clim([-0.01 1.8])
colormap(turbo)
view(0,90)
colorbar('Location','southoutside')
title('Polar Surface (Top View)')
You will have to add the appropriate arcs and annotations. To plot the arcs, use plot3 (since this is a 3D surface plot), and text for the alphanumeric information.
EDIT — (11 Aug 2024 at 32:02)
Changed ‘Z’.
.

类别

Help CenterFile Exchange 中查找有关 Colormaps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by