Tuesday, January 28, 2014

Linking Axes

When using multiple plots, especially subplots, it's possible to link the axes using the (you guessed it) linkaxes function. This function will link the axes so that the plots will move and zoom together, making it easier to compare the plots.

t = (0:(length(rc)-1))/fs;
x = sin(2*pi*1000*t);
y = sin(2*pi*1000*t + pi/4);


subplot(211); plot(t, x); 
ax(1) = gca; 
subplot(212); plot(t, y); 
ax(2) = gca; 
linkaxes(ax, 'xy'); 

No comments:

Post a Comment