I create a plot and add a secondary x-axis. The code for the secondary x-axis came from dbp in a post that for the life of me I can't find.
xm = 0:10;
xcm = xm*100;
h1 = get(gcf,'Children');
pos1 = h1.Position;
pos2 = pos1;
pos1(2) = pos1(2) + pos2(1);
pos1(4) = pos1(4) - pos2(1);
h1.Position = pos1;
h2 = axes('Position',pos2,'color','none');
h2.XColor = 'r';
h2.YColor = 'none';
This gives me the plot I want. But when I zoom, the plot zooms only the second axes (the red one) and doesn't change the plot.
So the first question is: what controls which axes is affected by the zoom? I thought it would be the current axes, but apparently that's not the case.
More importantly, what needs to be done so that zooming on the plot does what's expected for the plot and both sets of axes, as is is the case when zooming after using plotyy? I looked at plotyy and saw some code about axes pointing to each other and using some ListenerManager. Is that what keeps the axes synched when zooming?