How to display contour levels for some specific levels

조회 수: 15 (최근 30일)
University 2024년 1월 30일
편집: University 2024년 1월 31일
Is it possible to display contour levels for some specific values?
Z = peaks;
figure
[C,h] = contour(Z,8);
clabel(C,h)
title('Contours Labeled Using clabel(C,h)')
For instance, I want only the values (-1.6727, -0.0448059, 0.0648059, 3.6634) to be displayed on the contour instead of all the values.

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

채택된 답변

VBBV 2024년 1월 30일
편집: VBBV 2024년 1월 30일
Do you mean like this ?
Z = peaks;
figure
[C,h] = contour(Z,8);
v = [-1.6727, -0.0448059, 0.0648059, 3.6634]
v = 1×4
-1.6727 -0.0448 0.0648 3.6634
clabel(C,h,v) % pass the values in Clabel function as input argument
title('Contours Labeled Using clabel(C,h)')
댓글 수: 2없음 표시없음 숨기기
University 2024년 1월 31일
편집: University 2024년 1월 31일
Sorry to come back, I decided to use "text" function to do what I want but I still have a problem. On the attached the figure, I used text to display combination of each pairs of array, however I just want, for example pairs of L1(1), xi1(1), L1(2), xi1(2), L1(3), xi1(3)... not L1(1), xi1(1), L1(1), xi1(2), L1(1), xi1(3), ... L1(2), xi1(1), L1(2), xi1(2) to be displayed using the "text" funtion. See my code below:
xi=active_flow.xivals;
L =active_flow.Lvals;
xi1= [88.9474, 102.632, 88.9474, 123.158,75.2632, 75.2632, 116.315, 13.6842];
L1 = [1.4193e-06, 0.1069e-06, 1.76912e-06, 2.11895e-06, 3.8607-06, 5.26737e-06,...
6.31684e-06, 3.69825e-07];
fig3 = figure(3);
[C,h] = contourf(L, xi, intul, [min(min(intul)):1e-11:max(max(intul))],'ShowText','off','edgecolor','none');
c = colorbar;
c.TickLabelInterpreter='latex';
c.Label.String = '$\int u dy$';
c.Label.Interpreter = 'latex';
colormap jet
clabel(C,h)
hold on
for i=1:length(L)
for j=1:length(xi)
plot(L(i), xi(j), 'w.', 'LineWidth', 2, 'MarkerSize', 5)
for iL1 =1:length(L1)
for ixi1=1:length(xi1)
text(L1(iL1), xi1(ixi1), 'o', 'Color', 'red', 'FontSize',10)
end
end
end
end
set(gca,'clim',[min(min(intul)) max(max(intul))]);
University 2024년 1월 31일
편집: University 2024년 1월 31일
Please ignore this. I have been able to do it. Thank you

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

카테고리

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

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by