自定义轴刻度-“反向”对数?

rob*_*obf 5 math matlab octave

不好意思的标题;)

我正在尝试重新创建在其他工作中遇到的Matlab图,但我不太了解他们使用的比例尺。y轴增量如下(从顶部[+ ve y]开始):

0.9999、0.999、0.99、0.9、0

我可以使用符号学来绘制对数图,但这是一种错误的方法。我的增量去

1,0.1,0.01,0.001等

实际上是1- i,其中i是我实际想要的增量!无论如何,我并不完全理解如何描述这种情节。有人可以帮忙吗?

Jon*_*nas 6

要按照您想要的方式绘制轴,您必须执行三个步骤:(1) 绘制 1-y,(2) 反转轴 (3) 重新标记轴

y = [0.4 0.8 0.99 0.9999];

%# plot 1-y 
plot(1-y) %# alternatively use semilog, then you won't have to adjust 'yscale' below

%# reverse y-axis
set(gca,'ydir','reverse','yscale','log')

%# if necessary, set the axis limits here

%# relabel y-axis
set(gca,'yticklabel',num2str(1-10.^str2num(get(gca,'yticklabel'))))
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述