'Matlab: How can I zoom in/out with multiple axes on a plot
I create a plot and add a top x-axis to it. The top x-axis is a parameter equivalent to bottom x-axis based on a relation. The problem is that when I zoom, the plot zooms only the second axes (the red one) and doesn't change the plot. I appreciate it if someone could help me to fix this problem. Thank you in advance!
t = 0:0.05:10;
S = cos(t);
figure; plot(t, abs(S));
box off
xlabel('Time (ns)')
ylabel('Amplitude')
Tm = (t+10)./(0.0032*2*pi); %top x axis
%--------------------------------------------------------------------------
hAx = gca;
hAx = axes('Position',hAx.Position,'XAxisLocation','top','YAxisLocation','right','color','none');
%--------------------------------------------------------------------------
hAx.XLim = [Tm(1) Tm(end)];
hAx.XTick = linspace(Tm(1),Tm(end),11);
hAx.XColor = 'r';
hAx.XLabel.String = 'Equivalent Param.';
hAx.XLabel.FontSize = 10;
%--------------------------------------------------------------------------
hAx.YColor = 'r';
hAx.YTickLabel = ' ';
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
