【问题标题】:How do i get the upper (and lower) limits of an axis in MATLAB?如何在 MATLAB 中获得轴的上限(和下限)?
【发布时间】:2021-06-04 21:23:25
【问题描述】:

如何在 MATLAB 图中找到轴的最小值和最大值?

【问题讨论】:

    标签: matlab


    【解决方案1】:

    以下是对当前坐标区执行此操作的方法(即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
    

    上面的每个变量都是一个 1×2 数组,其中包含相应轴的最小值和最大值。您可以查看the documentation on axes properties了解更多信息。

    【讨论】:

      【解决方案2】:

      如果您介意使用属性方式使用

      xlim ylimzlim 检索最小值和最大值或

      xlim([minValue maxValue]) 设置限制。

      有关其他参数,请参阅set or query axis limits

      【讨论】:

        猜你喜欢
        • 2021-11-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-09-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多