I have a figure containing three instances of a graph plotting class. I want two of them to be able to zoom in/out in both the x and y direction, and one of the instances to be able to zoom in only the x direction. At the moment I can set the graphs to be able to zoom using
zoom(obj.Axes, 'on')
And this allows for zooming in both x and y directions. I want to be able to change the zoom characteristics of one of the graphs using a conditional statement, within the graph plotting class, like this
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
However when I implement this all three of the graphs are set to zoom in only the x direction. I think it may be a result of the zoom() function setting the zoom properties for all the graphs in the same figure, not just the one instance. What is confusing me though is that the title function is successfully setting the titles differently for each graph, same goes for xlabel and ylabel which I have left out here but are implemented the same way as title.
Any ideas about how to set the zoom property of each graph independently?
question from:
https://stackoverflow.com/questions/65901058/setting-one-instance-of-a-graph-to-zoom-in-the-x-direction-only 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…