2015-11-09 70 views
0

在Matlab中使用函数imagesc,我绘制了我的(X,Y,Z)数据-X数组距离,Y数组时间和我的数据Z = Z(X,Y)矩阵。Matlab对数范围colorbar图像c

我注意到,图像的80%,有一种颜色,因为只有在X年底发生的几乎所有Y.ž数据的变化

现在我用颜色表(“HSV”),它给我认为不同颜色的最大范围。

我需要的彩条范围内通过的时间沿距离X更改为一个对数,以提高我的输出数据的变化的视觉范围

我也用contourf但仍然我不知道,如果它会更好地使用此功能,而不是输出更平滑的imagesc。

请使用任何想法,任何方法或任何小脚本来显示2D对数比例尺数据中使用imagesc或其他函数构建函数的差异,这是非常值得欢迎的! 谢谢

+0

只想'于imagesc(X,Y,日志(Z))'工作? – chessofnerd

+0

不,我试过了,出现错误:“图像CData的数据类型无效。图像CData需要数字或逻辑矩阵。” – user1640255

+0

我不想改变这些数据,但我想改变表示数据的颜色,使用对数刻度的彩条,使用imagesc – user1640255

回答

0

在Mathworks网站上有一个讨论,有人提供了一个函数来做对数彩条。

https://www.mathworks.com/matlabcentral/newsreader/view_thread/152310

编辑:复制和粘贴的链接代码

function cbar = colorbar_log(my_clim) 
%COLORBAR_LOG Apply log10 scaling to pseudocolor axis 
% and display colorbar COLORBAR_LOG(V), where V is the 
% two element vector [cmin cmax], sets manual, logarithmic 
% scaling of pseudocolor for the SURFACE and PATCH 
% objects. cmin and cmax should be specified on a LINEAR 
% scale, and are assigned to the first and last colors in 
% the current colormap. A logarithmic scale is computed, 
% then applied, and a colorbar is appended to the current 
% axis. 
% 
% Written by Matthew Crema - 7/2007 

% Trick MATLAB by first applying pseudocolor axis 
% on a linear scale 
caxis(my_clim) 

% Create a colorbar with log scale 
cbar = colorbar('Yscale', 'log'); 

% Now change the pseudocolor axis to a log scale. 
caxis(log10(my_clim)); 

% Do not issue the COLORBAR command again! If you want to 
% change things, issue COLORBAR_LOG again. 
+0

请注意'Yscale'不再是'colorbar'的属性。 – dorverbin