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!