Plot only for positive y
조회 수: 8 (최근 30일)
이전 댓글 표시
I have
plot(x,y)
hold on
plot(x,z)
hold on
plot(x,w)
I need to have a plot for only positive y and z. I try to write
ylim([0,yMax])
But I do not know how to set for yMax. Please advise.
댓글 수: 2
채택된 답변
OCDER
2018년 6월 12일
편집: OCDER
2018년 6월 13일
NEW ANSWER
ylim([0 inf]) %Will automatically compute the limit where "inf" is used
OLD ANSWER
ylim([0, max([y(:); z(:); w(:)]))
%will plot positive values of y axis from 0 to the maximum of either your y or z or w values.
댓글 수: 3
OCDER
2018년 6월 13일
Actually, there was an easier solution. I'll update the answer:
ylim([0 inf]) %will automatically compute the limit where "inf" is used
Jack
2023년 5월 14일
this doesnt seem to work on my graph bit confused any ideas how I could be messing it up? im putting it after the plot(x,y) and have tried after title labels and after hold on so bit confused.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!