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

How to draw such a heatmap, should I use 'polaroplot' or 'colormap'?
怎么画出这样的热力图,应该使用polarplot还是colormap?
1 commentaire
Walter Roberson
le 11 Août 2024
Réponses (1)
Star Strider
le 11 Août 2024
Modifié(e) : Star Strider
le 11 Août 2024
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’.
.
Catégories
En savoir plus sur Color and Styling dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


