Somehow the 2nd X-Axis is not what it seems
조회 수: 3 (최근 30일)
이전 댓글 표시
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];
plot(x,y);
ax1 = gca;
set(ax1,'ylim',ylimit,'ytick',ytic);
ax2 = axes('Position',get(ax1,'Position'),'YAxisLocation','right','Color','none','YColor','blue','YMinorTick','on');
set(ax2,'ylim',tan(degtorad(ylimit)),'ytick',tan(degtorad(ytic)),'xtick',get(ax1,'xtick'),'xticklabel',[]);
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!
댓글 수: 2
Jan
2011년 10월 1일
Please add a definition for x and y, such that we can run your code. Without this, I cannot understand the description of the error.
답변 (3개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Two y-axis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!