필터 지우기
필터 지우기

Want to change the range of a single axis of a plotyy figure

조회 수: 3 (최근 30일)
Michael
Michael 2012년 12월 11일
댓글: Bijay Guha 2018년 4월 26일
Hi
I want my x-axis to be tight to the data on a plotyy graph. I can't seem to do it without messing up the axes.
My data ranges from 1e-5 to 1e3 and it's a semilogx plotting function. Is there a way I can use axis([...]) to specify all three ranges (x, y1, y2) at once?
Thanks for any help Mike

채택된 답변

Walter Roberson
Walter Roberson 2012년 12월 11일
There is no way to specify the limits all at once.
[ax h1 h2] = plotyy(x,y1,x,y2);
xlim(ax(1), ...);
xlim(ax(2), ...);
ylim(ax(1), ...);
ylim(ax(2), ...);
  댓글 수: 1
Bijay Guha
Bijay Guha 2018년 4월 26일
but using this command disrupts the alignment of two plots in vertical axis (on ranges from -10 to 50 other 0 to 0.003). If I want the same alignment as it done automatically by plotyy, it would be great. So how to do that??

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Muruganandham Subramanian
Muruganandham Subramanian 2012년 12월 11일
편집: Muruganandham Subramanian 2012년 12월 11일
figure;
ylim([1e-5 1e3]);
or
goto Edit -> Axes Properties -> then select X axis and change range as your need
  댓글 수: 3
Muruganandham Subramanian
Muruganandham Subramanian 2012년 12월 11일
편집: Muruganandham Subramanian 2012년 12월 11일
If you need to change x axis range is b/w 1e-5 to 1e3, you can use
xlim([1e-5 1e3])
or if it's not, can you explain precisely?
Michael
Michael 2012년 12월 11일
That is exactly what I want to do, but it's not working because it seems to generate a second axis. The original axis (not tight) is still there. I think the fact that it's a plotyy figure has an influence on the answer.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Two y-axis에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by