How can I set colorbar properly?

2 visualizaciones (últimos 30 días)
Szabó-Takács Beáta
Szabó-Takács Beáta el 16 de Sept. de 2015
Respondida: Chad Greene el 1 de Oct. de 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?

Respuestas (1)

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

Categorías

Más información sobre Colormaps en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by