2013-05-13 37 views

回答

2

colorbar實際上是一個axes對象,所以你可以添加像你將任何軸刻度線:

myTick = 37.53; 

c = colorbar(); 
ticks = get(c, 'YTick'); 
% Add your tick and sort so it's monotonically increasing 
ticks = sort([ticks myTick]); 
set(c, 'YTick', ticks); 

編輯:在評論,你問了一個方法,使自定義刻度在其他人中脫穎而出。您可以使用下面的方法做一個大膽的刻度:

% Here is an example plot 
pcolor(rand(100)); 
c = colorbar(); 
myTick = 0.45; % Change this for real data 

% Create a copy of the colorbar with transparent background and overlay 
c2 = copyobj(c, gcf); 
alpha(get(c2, 'Children'), 0); 
set(c2, 'Color', 'none'); 
set(c2, 'Position', get(c, 'Position')); 

% Give the copy a single tick mark and set its font style 
set(c2, 'YTick', myTick); 
set(c2, 'FontWeight', 'bold'); 
+0

謝謝Wakjah, 但你的解決方案woulnt從所有其他刻度線做出關鍵的對勾標記佼佼者。有什麼辦法可以讓它在視覺上脫穎而出嗎? – DankMasterDan 2013-05-13 23:06:52