我想编辑正在显示的一系列图像中的轴。
这是我的形象:
如您所见,从上到下的范围是0到大约500。我可以反转吗?另外,我想镜像显示的图像,以便从左到右开始...或者,如果可能的话,让轴从右到左显示。
回答:
要反转一个轴,可以将
当前轴的
'XDir'或
'YDir'属性设置为'reverse' :
set(gca,'XDir','reverse'); %# This flips the x axis 请记住,以这种方式翻转轴也会翻转绘图中的所有内容。这可能不是您要为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
更多&回答...