Weird plot axis range and ticks

조회 수: 5 (최근 30일)
Meva
Meva 2016년 10월 12일
댓글: Star Strider 2016년 10월 16일
Hello,
Just a quick question, I intended to compare numerical solutions and analytical solutions of a system. I plot them. But, the y-axis range is suspicious. Please see below plot.
Do you have any idea why Matlab doing this. I guess, the difference between two axis ticks is smaller than 10^(-4), that is why it did not include those 10^(-4) part. Am I right?
  댓글 수: 1
Meva
Meva 2016년 10월 12일
Okay I found an answer. Basically, I need to add
set(gca, 'YTickLabel', num2str(get(gca,'YTick')','%d'))
But now, my y-axis ticks look like
But I don't like this appearance. Is it possible to use
10^(-1)
notation or
decimal notation
instead of
e-01?
Also, how can I get rid of
two zeros
before
e
terms in y-axis ticks..

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

채택된 답변

Star Strider
Star Strider 2016년 10월 12일
It probably is. Instead of num2str, use sprintf.
Experiment with the format descriptor string to get the result you want.
  댓글 수: 9
Meva
Meva 2016년 10월 16일
I do appreciate your nice tips @Star Strider. This works.
Star Strider
Star Strider 2016년 10월 16일
As always, my pleasure.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by