Hi,
I am new to matlab. Trying to plot grap with 2 yaxis. I am trying to remove the scientific notation from yyaxis right using gca command but unable to do it. As shown in attached figure I need simple number format in yyaxis right. Can advice how to remove the scientific notation from yyaxis right.
My code is below
------
gdp = readtable(Zgdp);
gdpx = gdp.DateTime;
gdpy = gdp.Value;
pop = readtable(ZPop);
popy = pop.Value;
popx = pop.DateTime;
ax = gca;
ax.FontSize = 15;
yyaxis left
ar = area(gdpx, popy);
set(gca,'YLim', [0 2200])
yyaxis right
p2 = plot(gdpx,gdpy,'k');
set(gca,'YLim',[0 22000])

 채택된 답변

Star Strider
Star Strider 2021년 2월 6일

0 개 추천

See the Numeric Ruler Properties Exponent documentation section to set the exponent.

댓글 수: 4

vijay rs
vijay rs 2021년 2월 6일
I tried this but it works only if we have one y axis. what I am looking for is, both y-axis shouldnt have any scientific notation.
It works on the right y-axis. It is just necessary to call its attention to the axis to be modified:
x = linspace(0,10, 50);
yleft = sin(2*pi*x);
yright = x.^5;
figure
yyaxis left
plot(x, yleft)
yyaxis right
plot(x, yright)
Ax = gca;
Ax.YAxis(2).Exponent = 0;
Temporarily ‘comment-out’ the last line (that sets the exponent) to see the difference (and to demonstrate that it works as required).
vijay rs
vijay rs 2021년 2월 6일
Thanks. Intially I used Yaxis(2) that why it didnt worked. Now I tried YAxis(2) and it is working. So the command are case sensitive..
Thanks for your help.
Star Strider
Star Strider 2021년 2월 6일
As always, my pleasure!
In most instances, MATLAB is case-sensitive. There are a few exceptions with respect to the get and set function arguments (there may be a few others), however those are very rare exceptions.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

릴리스

R2020b

태그

질문:

2021년 2월 6일

댓글:

2021년 2월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by