0
這個問題在其他地方可以模糊地回答。因此,請在投票前回答並標記爲重複。我搜索了Stackoverflow和MATLAB論壇如何在MATLAB中爲多個空間子圖添加單個代表性顏色條?
我想繪製印度的空間情節(見下文),與多個子圖。 這裏我想使用一個代表性的顏色條,如圖所示。
我得到的顏色條是最後一個子圖,它的值與其他子圖不一致。
下面是,如何我嘗試添加的彩條和相應的輸出
ax(1)=subplot(2,3,1)
worldmap('India');
shape=shaperead('India.shp', 'UseGeoCoords', true);
geoshow(shape, 'FaceColor', 'w')
hold on
geoshow(lat,lon,data_fill, 'DisplayType', 'surface');
colormap('hsv');
.
.
.
ax(6)=subplot(2,3,6)
worldmap('India');
shape=shaperead('India.shp', 'UseGeoCoords', true);
geoshow(shape, 'FaceColor', 'w')
hold on
geoshow(lat,lon,data_fill, 'DisplayType', 'surface');
colormap('hsv');
h=colorbar;
cmin = min(data_fill_of_all_sub_plot);
cmax = max(data_fill_of_all_sub_plot);
if mod(cmax,5)==0
cmax=cmax+5;
else
cmax=cmax+(5-mod(cmax,5));
end
caxis([cmin cmax]) % to fix the colormap scale
set(h, 'Position', [.95 .42 .01 .5])
輸出
如何把所有的次要情節單一顏色吧?
我不明白:你想對所有的次要情節單一的彩條和顯示outputing正是你的代碼。什麼是問題? –
我爲所有子圖獲取單色條,但色條值與其他子圖不一致。這就像我只爲最後一個子圖放置了彩條。在這裏,我只有在ax(6)= subplot(2,3,3)中使用'caxis([cmin cmax])',我想現在需要將它包含在ax(1),ax(2),ax 3),ax(4)和ax(5)。我對嗎? – Mario
我不知道你在說什麼。爲什麼不在別人中使用caxis呢? –