Select zone of the plot
2 views (last 30 days)
Show older comments
Miguel Albuquerque
on 26 Jul 2022
Commented: Star Strider
on 27 Jul 2022
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?
0 Comments
Accepted Answer
Star Strider
on 26 Jul 2022
Edited: Star Strider
on 26 Jul 2022
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
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 Comments
More Answers (0)
See Also
Categories
Find more on Contour Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!