How do i get the upper (and lower) limits of an axis in MATLAB?

匿名 (未验证) 提交于 2019-12-03 02:59:02

问题:

How do I find the minimum and maximum of the axis in a MATLAB plot?

回答1:

Here's how you can do it for the current axes (i.e. gca):

xLimits = get(gca,'XLim');  %# Get the range of the x axis yLimits = get(gca,'YLim');  %# Get the range of the y axis zLimits = get(gca,'ZLim');  %# Get the range of the z axis 

Each variable above will be a 1-by-2 array containing the minimum and maximum values for the respective axis. You can check the documentation on axes properties for more information.



回答2:

If you mind going the properties way use

xlim ylim or zlim to retrieve min and max value or

xlim([minValue maxValue]) to set the limits.

See set or query axis limits for additional parameters.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!