Linking axes or using addlistener

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.

Antworten (0)

Gefragt:

am 4 Nov. 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by