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.
How can I set colorbar properly?
2 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Colormaps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!