Somehow the 2nd X-Axis is not what it seems
1 view (last 30 days)
Show older comments
I am plotting a 2nd y-axis to my existing codes without any data on it so I am actually 'converting' from one to the other, as below:-
ylimit = [0,35];
ytic = [0 5 10 15 20 25 30 35];
ax1 = gca;
ax2 = axes('Position',get(ax1,'Position'),'YAxisLocation','right','Color','none','YColor','blue','YMinorTick','on');
Everything looks good when it is plotted. BUT, when I am enlarging the figure, it seems like the 2nd y-axis is actually not aligning its position of x=0 with ax1, with a black line distinguishing it. I printed the graph using 'print' function and still I am seeing the same thing.
I tried a lot of other ways but still couldn't get it.
I would appreciate your help a lot! Thanks!
Walter Roberson on 2 Oct 2011
Looks like a case for plotyy() or linkaxes()
Find more on Annotations 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!