在matlab中缩放轴的一部分

时间:2014-01-21 19:01:32

标签: matlab

我有以下图像,我希望深度轴范围如下: (10 9.5 9 8.5 8 7.5 7 6 5 3 2 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0)以更大的比例显示深度1和0之间的数据,我有以下代码

depths = [10 5 1 0.5 0; 10 5 1 0.5 0] % these are the real depths in meter
contourf(points,depths,RFU15102013_BloomAsMainPoint);
set(gca, 'XTick', points(1) : points(2), 'XTickLabel',{ 'LSB1', 'LSB2'});
ylabel('Depth(m)');
xlabel('Points');
title('Date: 15.10.2013');

这是图像: enter image description here

我该怎么做?

EDIT1

真实数据:

RFU15102013_BloomAsMainPoint = [ 2.71 1.23 1.30 1.20 14.37 ; 2.51 1.36 1.01 1.24 1.15];

points = [1 1 1 1 1; 2 2 2 2 2 ];

depths = [10 5 1 0.5 0; 10 5 1 0.5 0];

2 个答案:

答案 0 :(得分:1)

由于大多数数据在零附近变化,因此可能足以改变Y轴的缩放。这是一个例子

close all; clear all;

z = [ 2.71 1.23 1.30 1.20 14.37 ; 2.51 1.36 1.01 1.24 1.15];
x = repmat([1; 2], 1, 5);
y = repmat([10 5 1 0.5 0], 2, 1);

% plotting with equally spaced y-s
h = subplot(1,2,1);
contourf(x,y,z);

y2 = log(y + 0.25);
yTicks = linspace(min(y2(1,:)), max(y2(1,:)), 10);

% plotting with logarithmically spaced y-s
h = subplot(1,2,2)
contourf(x,y2,z);
set(h,'YTick', yTicks)
set(h,'YTickLabel', exp(yTicks) - 0.25);

print('-dpng','scaling.png')

结果 contour plot

这样可以应用任何用于轴缩放的单调连续函数。

答案 1 :(得分:0)

您可以使用mathworks文件交换中的UIMAGE - UIMAGESC并将y值设置为强调1到0范围内的点。