如何在MATLAB中编辑图像的轴以反转方向?

NLe*_*Led 13 matlab plot axes image-processing

我想编辑正在显示的系列图像中的轴.

这就是我的图像:

抛物线

如您所见,它从上到下的范围从0到大约500.我可以反转吗?另外,我想镜像所显示的图像,以便它从左到右开始...或者,如果可能的话,让轴从右到左显示.

gno*_*ice 17

要反转轴,可以将当前轴'XDir''YDir'属性设置为:'reverse'

set(gca,'XDir','reverse');  %# This flips the x axis
Run Code Online (Sandbox Code Playgroud)

请记住,以这种方式翻转轴也可以翻转图中的所有内容.这可能不是你想要为y轴做的.您可能只想翻转y轴标签,您可以通过'YTickLabel'以下方式修改属性来执行此操作:

yLimits = get(gca,'YLim');  %# Get the y axis limits
yTicks = yLimits(2)-get(gca,'YTick');  %# Get the y axis tick values and
                                       %#   subtract them from the upper limit
set(gca,'YTickLabel',num2str(yTicks.'));  %'# Convert the tick values to strings
                                           %#   and update the y axis labels
Run Code Online (Sandbox Code Playgroud)