I want show population on plot like 36M, 37M....

조회 수: 1 (최근 30일)
Ghazi
Ghazi 2024년 6월 17일
댓글: John D'Errico 2024년 6월 18일
please help me, I=I need the grow population like 36m, 37, 38,.. on plot

채택된 답변

John D'Errico
John D'Errico 2024년 6월 17일
편집: John D'Errico 2024년 6월 17일
You want the plot to plot each point as a string like 36M, 38M, etc?
Why not just divide by 1e6, then use the axis label to indicate millions?
P = [3.6e7, 3.8e7, 4.1e7, 4.5e7, 5.0e7]; % just making up some numbers
t = 1970:10:2010;
plot(t,P/1e6,'-o')
xlabel Years
ylabel 'Population in Millions'
Could you plot the points as text strings? Well, yes. Easily enough, using the function text. But seriously, why?
  댓글 수: 4
Ghazi
Ghazi 2024년 6월 18일
thank you bro
John D'Errico
John D'Errico 2024년 6월 18일
You are now asking a completely different question. But that is also clearly a homework assignment, and I last had any desire to do homework at least 35 years ago. Probably longer than that, but I'm not going to count.
So look at your class notes. Read your text. Think about how you would formulate an exponential growth model.

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2024년 6월 18일
이동: Walter Roberson 2024년 6월 18일
Alternate solution:
P = [3.6e7, 3.8e7, 4.1e7, 4.5e7, 5.0e7]; % just making up some numbers
t = 1970:10:2010;
ax = gca;
plot(ax, t,P,'-o')
xlabel(ax, 'Years')
ylabel(ax, 'Population in Millions')
yticklabels(ax, compose("%gM", floor(ax.YTick/1e6)))

카테고리

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

태그

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by