How to keep the same scale between several figures?

7 views (last 30 days)
Hello,
I made a program allowing me to obtain output values according to the inputs.
However, now I want to vary input parameters and be able to compare figures between them according to the input parameters.
The data I draw are contained in a matrix and are displayed using the 'contourf' function. Each time I want to redo a calculation with another input parameter, the scale of the color bar is automatically updated according to the data. I would like to be able to block it so that it always acts between 2 and 9, even if the data is between 2 and 5 for example.
Mon code pour afficher ces cartes est le suivant :
figure;
set(gcf,'position',[0,0,1040,828]);
contourf(Lon,Lat,DataProdArea,[linspace(2,9.5,50)])
b=colorbar
b.Label.String = 'Production in W/m²';
Thank you for your help !

Accepted Answer

Ameer Hamza
Ameer Hamza on 16 Nov 2020
You can add the following line at end of your code
caxis([2 9])

More Answers (0)

Categories

Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!