![]() |
如何在MATLAB中编辑图像的轴以反转方向?
我想编辑正在显示的一系列图像中的轴。
这是我的形象: [URL="https://i.stack.imgur.com/O5qpq.png"][IMG]https://i.stack.imgur.com/O5qpq.png[/IMG][/URL] 如您所见,从上到下的范围是0到大约500。我可以反转吗?另外,我想镜像显示的图像,以便从左到右开始...或者,如果可能的话,让轴从右到左显示。 [B]回答:[/B] 要反转一个轴,可以将[URL="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/gca.html"]当前轴[/URL]的[URL="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/axes_props.html#XDir"]'XDir'[/URL]或[URL="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/axes_props.html#YDir"]'YDir'[/URL]属性设置为'reverse' : set(gca,'XDir','reverse'); %# This flips the x axis 请记住,以这种方式翻转轴也会翻转绘图中的所有内容。这可能不是您要为y轴执行的操作。您可能只想翻转y轴[I]标签[/I] ,可以通过以下方式修改[URL="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/axes_props.html#YTickLabel"]'YTickLabel'[/URL]属性来完成: 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 [url=https://stackoverflow.com/questions/2865600]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 01:22。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.