Trouble with reproducing same colorbar for different figures
1 次查看(过去 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.
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Colorbar 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!