How can I set colorbar properly?

1 Ansicht (letzte 30 Tage)
Szabó-Takács Beáta
Szabó-Takács Beáta am 16 Sep. 2015
Beantwortet: Chad Greene am 1 Okt. 2015
I created a map with map_m packege by:
m_proj('lambert','lon',[-34.748 60.8422],'lat',[26.5861 71.8699]);
m_coast('patch',[1 .85 .7]);
>> m_pcolor(lon,lat,clim5);
set(findobj('tag', 'm_pcolor'), 'edgecolor', 'none');
colormap(map);
h=colorbar;
labels={'ET'; 'BSk'; 'BWh'; 'BWk'; 'Dfc'};
h=colorbar;
set(h,'YTickMode','manual','YTick',[1:length(map)],'YTickLabelMode','manual','YTickLabel',labels);
The resulted map is attached. Unfortunately the labels are not correct in the colorbar. The should have be 'ET'; 'BSk'; 'BWh'; 'BWk'; 'Dfc' from down to up. How can I set them correctly?

Antworten (1)

Chad Greene
Chad Greene am 1 Okt. 2015
Looks like this issue keeps popping up. Unless the values in clim5 are only 1, 2, 3, 4, and 5, using 'YTick' values of 1:length(map) will not be right.

Kategorien

Mehr zu Colormaps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by