필터 지우기
필터 지우기

Trouble with reproducing same colorbar for different figures

조회 수: 2 (최근 30일)
Jaime  de la Mota
Jaime de la Mota 2017년 2월 25일
답변: Image Analyst 2017년 2월 25일
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