contourf plot different display problem

I want to draw a contour plot, the data is similar, the colormap is the same (created by jet(17)), and the data range is the same (caxis([1 17])), the difference is that:
in plot1, the data range is 1-12,
in plot2, the data range is 1-15.
below is the result:
the value in the red circle is in the same color but the display is not.
I also attached the test file and test code.
is there anyway to solve this problem?
Thanks!
Yu

6 commentaires

Walter Roberson
Walter Roberson le 5 Oct 2018
I do not see any obvious problem with those plots ?
Remember, when you call contour() or contourf() without passing in a contour level list (non-scalar) then the routines will automatically pick the levels to contour at according to the data range.
Yu Li
Yu Li le 5 Oct 2018
I revise the description, please see posted.
jonas
jonas le 5 Oct 2018
Modifié(e) : jonas le 5 Oct 2018
Walter is right, the two plots have different levellists. If you add this name-value pair in both contour calls then you will get your desired plots
[xc1,yc1]=contourf(...,'levellist',[0:2:20]);
Yu Li
Yu Li le 5 Oct 2018
Ok, since setting the level list can make the contour have the same range of value, so what is the meaning of caxis for? seems caxis has the same effect, is there any mistake with my understanding?
https://www.mathworks.com/help/matlab/ref/caxis.html
jonas
jonas le 5 Oct 2018
Modifié(e) : jonas le 5 Oct 2018
It's not the same. The caxis sets the max and min for the colorbar and levellist specifies the contour levels to be drawn. Try setting
caxis([0 100])
and you will see what happens.
Yu Li
Yu Li le 5 Oct 2018
Ok I got it.
Thank you very much!
Bests!
Yu

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Contour Plots dans Centre d'aide et File Exchange

Question posée :

le 5 Oct 2018

Commenté :

le 5 Oct 2018

Community Treasure Hunt

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

Start Hunting!

Translated by