필터 지우기
필터 지우기

Extract graph axis limits actually used when [-inf inf] has been used to assign limits

조회 수: 1 (최근 30일)
Tim
Tim 2020년 3월 3일
댓글: Tim 2020년 3월 10일
My script is written to use either [-inf inf -inf inf] or an assigned set of axis limits as a variable since the script may instead compute a desired set of limits to be applied as the limit set. I need to know the limits that are actually used in order to add text to the graph. If I assign specific limits to the axis as a variable (computed or manually assigned), no problem. But if [-inf inf -inf inf] is used as the limit call, any inquiry as to the actual limits used < get(gca,'ylim') > after plotting and before adding the text, the values returned are [-inf inf], not the actual values. How do I get the values actually used when [-inf inf -inf inf] is the default input?

답변 (1개)

Keerthana Chiruvolu
Keerthana Chiruvolu 2020년 3월 6일
Hi,
You may set the ylim() to ‘auto’ instead of inf and then use the get(gca,’ylim’) to obtain the y limit values. This might help.
  댓글 수: 1
Tim
Tim 2020년 3월 10일
Keerthana, this works just great! Thank you. I actually found where I asked this question 3-4 years ago (copied and pasted it) and I never got an answer and have struggled with it ever since. You get extra points : ))).

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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by