How can I modify the values of the y axes

조회 수: 2 (최근 30일)
Fidele Adanvo
Fidele Adanvo 2021년 3월 11일
댓글: Star Strider 2021년 3월 11일
Hello!
How are you?
How can I modify the values of the y axes?
For example, let's suppose that when summing a figure, I get the following (1000, 10000, 100000) on the Y axis but I want it this way (10 ^ 3, 10 ^ 4, 10 ^ 5).
How can you change this automatic matlab configuration? I also want to assign it the interval that I want.

채택된 답변

Star Strider
Star Strider 2021년 3월 11일
Modifying them depends on the axis scale. If they are linearly-scaled, use the Exponent property in Tick Values and Labels in the NumericRuler Properties documentation. However, that does not appear to work on log-scaled axes, so you would likely need to create your own y-tick labels. Use the compose function to create them.
  댓글 수: 2
Fidele Adanvo
Fidele Adanvo 2021년 3월 11일
Apparently the log-scale doesn't work. Could you give an example of how to solve it with the compose function? thanks
Star Strider
Star Strider 2021년 3월 11일
Try this example with your plot:
x = 0:10;
y = x.^4;
figure
semilogy(x, y)
grid
Ax = gca;
yt = Ax.YTick;
Ax.YTickLabel = compose('10^{%d}',log10(yt));
I cannot tell what your plot is since I have not seen it. This works on the plot in this example.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by