Select zone of the plot

조회 수: 2 (최근 30일)
Miguel Albuquerque
Miguel Albuquerque 2022년 7월 26일
댓글: Star Strider 2022년 7월 27일
Hey guys, thanks in advance,
Is there a way of representing azimuth3, only the red zones, which means, selecting only the most red zones of the plot?

채택된 답변

Star Strider
Star Strider 2022년 7월 26일
편집: Star Strider 2022년 7월 26일
This can certainly be done, however it is definitely not trivial!
Try this —
LD = load('Miguel Albuquerque azimuth3.mat');
azimuth3 = LD.azimuth3;
figure
[M,C] = contourf(azimuth3,25, 'EdgeColor','none');
Levels = C.LevelList
Levels = 1×26
1.0e+06 * 0.0001 0.0657 0.1314 0.1970 0.2626 0.3282 0.3939 0.4595 0.5251 0.5908 0.6564 0.7220 0.7876 0.8533 0.9189 0.9845 1.0501 1.1158 1.1814 1.2470 1.3127 1.3783 1.4439 1.5095 1.5752 1.6408
for k = 1:numel(Levels)
idx = find(M(1,:) == Levels(k));
ValidV = rem(M(2,idx),1) == 0;
StartIdx{k,:} = idx(ValidV);
VLen{k,:} = M(2,StartIdx{k});
end
colormap(turbo)
title('Original Filled Contour Plot')
v = axis(gca); % Get Original Axis Limits
[HiLvls,idx] = maxk(Levels,9); % Choose 9 Highest Contours
idx = flip(idx);
cm = turbo(numel(Levels)); % Define 'colormap' For This Plot
figure
hold on
for k = 1:numel(idx)
k1 = idx(k);
for k2 = 1:numel(k1)
idxv = StartIdx{k1}(k2)+1 : StartIdx{k1}(k2)+VLen{k1}(k2); % Index For Contour 'k1'
xv = M(1,idxv);
yv = M(2,idxv);
patch(xv, yv, cm(k1,:), 'EdgeColor','none') % Fill & Colour The Chosen Contours
end
end
hold off
axis(v)
title('Highest Level Contours')
Make appropriate changes to work as you want it to with your data.
EDIT — (26 Jul 2022 at 21:04)
Increased the number of contours to be plotted in the second plot.
.
  댓글 수: 2
Miguel Albuquerque
Miguel Albuquerque 2022년 7월 27일
Thanks a lot :D
Star Strider
Star Strider 2022년 7월 27일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by