Problem with colorbar in subplot

4 views (last 30 days)
Jaime  de la Mota
Jaime de la Mota on 12 Mar 2017
I have made the following code for representing physical measurements in the region of Angola for the twelve months of the year.
All subplots have the same colorbar for easy distinction between months. I want it to have only one big colorbar instead of twelve small ones.
mediamensual=nanmean(datos,3); %this means monthly mean
auxiliar2=max(mediamensual);
m=max(auxiliar2);
mn=0;
f=linspace(0,1,100);
for j=1:12
subplot(3,4,j)
ax = worldmap('angola');
load coastlines
setm(ax, 'Origin', [0 20 0])
plotm(coastlat,coastlon);
hold on
for a=1:190
c=(mediamensual(:,j)-mn)/(m-mn);
color2=[c c c];
lat=coord(a,1);
lon=coord(a,2);
%geoshow('landareas.shp', 'FaceColor', [0.5 1.0 0.5]);
geoshow(ax, lat, lon, 'DisplayType', 'point', 'MarkerEdgeColor', color2(a,:),'Marker', '.', 'MarkerSize', 10)
end
colormap(f'*ones(1,3))
caxis([mn m])
colorbar
end
Any idea is appreciated. Thanks for reading

Answers (0)

Community Treasure Hunt

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

Start Hunting!