zoom 'auto' doesn't work with linkaxes when data is replaced
Show older comments
I plot two subplots in my figure. After changing the data of the plots, the behavior of a 'doubleclick' in zoom mode doesn't work well anymore. It fits the axes limits to the OLD data instead of the new data. This problem appears only when the axes are linked.
x1 = 0:5;
y = rand(size(x1));
y2 = rand(size(x1));
ax1 = subplot(2,1,1)
myPlt1 = plot(x1, y);
ax2 = subplot(2,1,2)
myPlt2 = plot(x1, y2);
linkaxes([ax1 ax2], 'x');
waitfor(warndlg('Now zoom a bit in one of the two axes'))
x2 = x1/2;
myPlt1.XData = x2
myPlt2.XData = x2
warndlg('doubleclick on axes will cause x axes zoom to 0-5 instead of 0-2.5')
Accepted Answer
More Answers (0)
Categories
Find more on Data Exploration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!