Azzera filtri
Azzera filtri

How to set contour levels

6 visualizzazioni (ultimi 30 giorni)
University Glasgow
University Glasgow il 17 Feb 2023
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.

Risposte (1)

Steven Lord
Steven Lord il 17 Feb 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 Commento
University Glasgow
University Glasgow il 17 Feb 2023
Modificato: University Glasgow il 17 Feb 2023
Thank you Steven, Do mean something like this:
contourf(u, xi, Da1(:, :), [-2 2]);
I got the attached figure. I'm suspecting that is not correct because the region between the two yellow colors in the attached figure is nonzero. Is is possible to replace that region with different color apart from blue?

Accedi per commentare.

Categorie

Scopri di più su Contour Plots in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by