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!