MATLAB: Trouble with reproducing same colorbar for different figures

colorbar

I have designed a program for plotting the standar deviation value of a certain variable measured on different stations on each month of the year, but when I plot it, each map has it's own scale and I want all of them with the same numbers for easy distinction between months. This is the program:
auxiliar=nanstd(data,0,3);
for j=1:12
figure(j)
ax = worldmap('angola');
load coastlines
setm(ax, 'Origin', [0 20 0])
plotm(coastlat,coastlon);
hold on
m=max(auxiliar(:,j));
mn=min(auxiliar(:,j));
for a=1:190
c=(auxiliar(:,j)-mn)/(m-mn);
color2=[c c c];
lat=coord(a,1);
lon=coord(a,2);
geoshow(ax, lat, lon, 'DisplayType', 'point', 'MarkerEdgeColor', color2(a,:),'Marker', '.', 'MarkerSize', 20)
end
colormap([sort(c),sort(c),sort(c)])
caxis([mn m])
colorbar
end
Can someone please tell me how can I put the same colorbar for the twelve months of the year?
Thanks for reading.

Best Answer

You need to compute the OVERALL mn and m, which means you need to finish that loop first, and then loop over all colorbars calling caxis() in a second loop, because obviously you don't know what the overall min and max are until you've finished the first loop.