首页 > 解决方案 > 将图形的一个实例设置为仅在 x 方向上放大

问题描述

我有一个包含图形绘图类的三个实例的图形。我希望其中两个能够在 x 和 y 方向上放大/缩小,并且其中一个实例能够仅在 x 方向上放大。目前我可以将图表设置为能够使用缩放

zoom(obj.Axes, 'on')

这允许在 x 和 y 方向上进行缩放。我希望能够在图形绘图类中使用条件语句更改其中一个图形的缩放特性,如下所示

if strcmp(obj.Type, "Axes3") % obj.Type is a descriptor, set when the instances are created, that I am using to
                             % differentiate between the graphs, for the other two graphs these would be
                             % "Axes1" and "Axes2"
    zoom(obj.Axes, 'xon');
    title(obj.Axes, "Graph 3");
else
    zoom(obj.Axes, 'on');
    title(obj.Axes, "Other Graphs");
end

但是,当我实现这个时,所有三个图表都设置为仅在 x 方向上放大。我认为这可能是 zoom() 函数为同一图中的所有图形设置缩放属性的结果,而不仅仅是一个实例。令我困惑的是,标题函数成功地为每个图形设置了不同的标题,我在这里省略的 xlabel 和 ylabel 也是如此,但实现方式与标题相同。

关于如何独立设置每个图形的缩放属性的任何想法?

标签: matlaboopgraphzooming

解决方案


推荐阅读