How to set contour levels
조회 수: 27 (최근 30일)
이전 댓글 표시
Hi, I'm trying to plot a contour. I tried this:
contourf(u, xi, Da1(:, :), 50);
and I got the attached figure Contour1 with contour levels of 50. However, I didn't get the desired result. I expected the zero region, which is for values of \xi_c above zero and some \xi_c values below zero. But is not matching with the contour levels. There are regions that are non- zero but still show blue colour. I want the blue colour to correspond to only zero levels of the contour and any other levels to assume different colors.
In an attempt to achieve this, I tried this:
contourf(u, xi, Da1(:, :), 10.^( min(Da1(:, end)) : 0.02: max(Da1(:, end))));
I got the second figure: Contour2, which is not what I'm expecting. Why is it showing a white region that is not on the contour legend? Please how can I fix this.
댓글 수: 0
답변 (1개)
Steven Lord
2023년 2월 17일
and I got the attached figure Contour1 with contour levels of 50
No, that syntax creates 50 contour levels. To specify a single contour level at an integer-valued level (to avoid ambiguity with the number of contour levels syntax) you need to specify a vector with two elements each of which is the contour level. Compare:
[x, y, z] = peaks;
contour(x, y, z, 2)
title('2 contour levels')
figure
contour(x, y, z, [2 2])
title('contour level at z = 2')
참고 항목
카테고리
Help Center 및 File Exchange에서 Contour Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!