How can I set colorbar properly?

1 visualizzazione (ultimi 30 giorni)
Szabó-Takács Beáta
Szabó-Takács Beáta il 16 Set 2015
Risposto: Chad Greene il 1 Ott 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?

Risposte (1)

Chad Greene
Chad Greene il 1 Ott 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.

Categorie

Scopri di più su Colormaps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by