Linking axes or using addlistener
Show older comments
I have two x axes associated with the same y data. It looks like this:
x1 = 1:10;
x2 = 10*x1;
y = x1.^2;
subplot(211)
plot(x1,y)
ax1 = gca;
subplot(212)
plot(x2,y)
ax2 = gca;

The second set of x axes are 10 times x1. I'd like to do something like linkaxes because I want to be able to zoom in on the first subplot and have the second subplot limits update automatically. It seems simple, but I can't quite figure out how to do it. addlistener seems like it might be the ticket, but the documentation doesn't make clear how I could use it for this simple task.
Answers (0)
Categories
Find more on Subplots 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!