graphing - How to add marker to matlab colorbar? -
i want add tarker/special tick mark specific values in matlab colorbars. example, lets have colorbar scale -20 60 , critical value 37.53, how can add marker value of colorbar?
the colorbar
axes
object, can add tickmarks axes:
mytick = 37.53; c = colorbar(); ticks = get(c, 'ytick'); % add tick , sort it's monotonically increasing ticks = sort([ticks mytick]); set(c, 'ytick', ticks);
edit: in comments, have asked way make custom tick mark stand out amongst rest. can make single bold tick mark using following method:
% here example plot pcolor(rand(100)); c = colorbar(); mytick = 0.45; % change real data % create copy of colorbar transparent background , overlay c2 = copyobj(c, gcf); alpha(get(c2, 'children'), 0); set(c2, 'color', 'none'); set(c2, 'position', get(c, 'position')); % give copy single tick mark , set font style set(c2, 'ytick', mytick); set(c2, 'fontweight', 'bold');
Comments
Post a Comment