Why does the zoom property get disabled if I add points to my plot after I enable the zoom property?
1 view (last 30 days)
Show older comments
Why does the zoom property get disabled if I add points to my plot after I enable the zoom property?
If I set the 'zoom' property of a figure to 'on' and then hold the plot and plot something else to the figure, the zoom property of the figure automatically gets disabled. Is this the intended behavior of the zoom command?
To reproduce the problem please run the following commands (one at a time) and observe the zoom state on the figure toolbar.
surf(peaks)
hold on
zoom on
plot(1:10)
Note that after step 4, the zoom state gets disabled automatically.
I am not sure if this behavior is intended, or if it is a bug.
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
This bug has been fixed in Release 2006a (R2006a). For previous product releases, read below for any possible workarounds:
This is the intended behavior in order to keep current the information of the state of the axes and its contents.
The workaround is to save the zoom status before adding points to the plot, and use it after plotting.
PLEASE NOTE: The 'getmode' feature of the ZOOM command has been tested for MATLAB 6.1 (R12.1). Therefore, this feature may not apply to other versions of MATLAB.
The following code can be used as a guide to work around the problem.
figure;
plot(10:-1:1);
hold on
zoom on
zoomstatus=zoom('getmode');
plot(1:10);
if zoomstatus=='in'
zoom on
end
0 Comments
More Answers (0)
See Also
Categories
Find more on Visual Exploration in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!