how can i adjust y-axis scale of 'semilogy' function

조회 수: 86 (최근 30일)
JaeSung Choi
JaeSung Choi 2018년 3월 30일
답변: Prasanth Sunkara 2018년 4월 2일
I want to set y scale from 10^(-2) to 10^7 following problem.
x = 0:0.1:10;
y = exp(x);
figure
semilogy(x,y)
But as you can see this shows only from 10^0 to 10^5 for y-axis. How can i change this?

채택된 답변

Prasanth Sunkara
Prasanth Sunkara 2018년 4월 2일
By default, plot (or any other plotting command) adjusts the y-axis limits to fit the data "compactly". However, you can override this behavior, and adjust the limits using ylim command.
In your example, we can add the following command to fit the y-limits.
ylim([10^(-2) 10^7])
Hope this helps!
Thanks,
Prasanth

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 그래픽스 객체 프로그래밍에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!