Custom levels in contourf

Hi,
I am trying the get a contourf plot with the levels I want, but I am not able. MATLAB does not let me like in the documentation example.
I am trying to plot CI matrix (field) with levels like in this figure, i.e., not equally spaced: http://www.atmos.albany.edu/student/abentley/realtime/images/northamer/coupling/coupling_57.png
My try:
load variablesForQuestion
v20=[-25 -20 -15 -10 -5 0 5 10 15 22.5 25];
[C,h] = contourf(lon,lati,CI,v20); colorbar()
Thanks!

3 comentarios

Turlough Hughes
Turlough Hughes el 28 de Dic. de 2021
Best to attach the variables in your question. You can use:
save variablesForQuestion lon lati CI v20
and attach the corresponding variablesForQuestion.mat file either in a comment or by editing your question.
JUAN JESUS GONZALEZ ALEMAN
JUAN JESUS GONZALEZ ALEMAN el 28 de Dic. de 2021
I have uploaded them.
Walter Roberson
Walter Roberson el 30 de Dic. de 2021
It is not obvious what the difference is between what you want and what you get?

Iniciar sesión para comentar.

Respuestas (1)

Chunru
Chunru el 30 de Dic. de 2021
load variablesForQuestion
v20=[-25 -20 -15 -10 -5 0 5 10 15 22.5 25];
subplot(131);
% Your data CI has range from -17 t0 100
[C,h] = contourf(lon,lati,CI); colorbar
subplot(132);
% The custom level has a much smaller range [-25 25], so the contour plot
% has large patch of yellow color (25 and above)
[C,h] = contourf(lon,lati,CI,v20); colorbar
subplot(133);
% You need a suitable custom level. For example
v20=[-20 -15 -10 -5 0 5 10 15 22.5 25 40 60 80 100];
[C,h] = contourf(lon,lati,CI,v20); colorbar

Categorías

Más información sobre Contour Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 28 de Dic. de 2021

Respondida:

el 30 de Dic. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by