How can I set colorbar properly?

2 vues (au cours des 30 derniers jours)
Szabó-Takács Beáta
Szabó-Takács Beáta le 16 Sep 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?

Réponses (1)

Chad Greene
Chad Greene le 1 Oct 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.

Catégories

En savoir plus sur Colormaps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by