Trouble with reproducing same colorbar for different figures

2 次查看(过去 30 天)
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.

采纳的回答

Image Analyst
Image Analyst 2017-2-25
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Colorbar 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by