필터 지우기
필터 지우기

Show only a part of the yaxis

조회 수: 5 (최근 30일)
Sim
Sim 2023년 7월 3일
댓글: Les Beckham 2023년 7월 4일
How can I show only a part of the yaxis (i.e. from zero to infinity), as shown in the right figure, here below?
My desired output is the figure on the right. The original figure comes from
https://stackoverflow.com/questions/1490778/how-to-show-x-and-y-axes-in-a-matlab-graph

채택된 답변

Les Beckham
Les Beckham 2023년 7월 3일
편집: Les Beckham 2023년 7월 3일
Here is a kind of messy workaround. Note that this doesn't work if you have the grid on.
h = plot(linspace(-2, 2, 1000), atan(linspace(-2, 2, 1000)));
set(gca, 'XAxisLocation', 'origin', 'YAxisLocation', 'origin');
% draw a white line over the top of the bottom half of the y axis
line([0 0], [0 min(ylim)], 'Color', [1 1 1]);
set(gca, 'Ytick', [0 0.5 1]) % turn off the y ticks at -1 and -0.5
  댓글 수: 4
Sim
Sim 2023년 7월 4일
That's great @Les Beckham!! :-) Many Many thanks :-)
Les Beckham
Les Beckham 2023년 7월 4일
Of course. Have a great day.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by