Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
高级会员
注册日期: 2019-11-21
帖子: 3,006
声望力: 66 ![]() |
![]()
我想编辑正在显示的一系列图像中的轴。
这是我的形象: ![]() 如您所见,从上到下的范围是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 更多&回答... |
![]() |
![]() |