【发布时间】:2017-08-13 13:51:05
【问题描述】:
我想在颜色条上制作第二个刻度,但刻度的值已关闭,例如 0.2 应该是 14.33 , 0.4 应该是 13.57 等等。
这是相关的代码:
hFig = figure('Name','False Color Luminance Map', 'ToolBar','none', 'MenuBar','none');
% Create/initialize default colormap of jet.
cmap = parula(16); % or 256, 64, 32 or whatever.
% Now make lowest values show up as black.
cmap(1,:) = 0;
% Now make highest values show up as white.
cmap(end,:) = 1;
imshow(J,'Colormap',cmap) % show Image in false color
colorbar % add colorbar
h = colorbar; % define colorbar as variable
caxis auto
y_Scl = (1/C);
yticks = get(h,'YTick');
set(h,'YTickLabel',sprintfc('%g', [yticks.*y_Scl]))
ylabel(h, 'cd/m^2')% add unit label
BarPos = get(h,'position');
haxes = axes('position',BarPos,'color','none','ylim',[0 150]);
set(haxes,'YTickLabel', sprintfc('%g', log10(yticks.*y_Scl/108000)/-0.4));
在我看来,错误必须在最后两行的某个地方。
编辑: 当我改变 haxes = 轴('位置',BarPos,'颜色','无','ylim',[0 150]); 到 haxes = 轴('位置',BarPos,'颜色','无','ylim',[0 150]); 我明白了 所有正确的值都在那里,但没有正确对齐!
【问题讨论】:
标签: image matlab axis-labels colorbar