2015-11-09 48 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