How to set contour levels
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Steven Lord
le 17 Fév 2023
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')
1 commentaire
Voir également
Catégories
En savoir plus sur Contour Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!