필터 지우기
필터 지우기

How to convert long to scientific e format in plots legend?

조회 수: 3 (최근 30일)
Kalasagarreddi Kottakota
Kalasagarreddi Kottakota 2022년 6월 10일
댓글: Bjorn Gustavsson 2022년 6월 10일
txt = ['lambda = ',num2str(lambda(check))];
plot(1:100, abs(Arec(:,2000)),'DisplayName',txt)% capon
legend show
How to change the long format to scieitific e, like 1e6 in legend?

답변 (1개)

Bjorn Gustavsson
Bjorn Gustavsson 2022년 6월 10일
You could be a bit more explicit in the call to legend:
txt = ['lambda = ',num2str(lambda(check))];
ph = plot(1:100, abs(Arec(:,2000))); % ,'DisplayName',txt); % capon
leg_str = sprintf('lambda = %3.3g',lambda(check));
legend(ph,leg_str)
HTH
  댓글 수: 2
Rik
Rik 2022년 6월 10일
Or edit the display text property to have the e format.
Bjorn Gustavsson
Bjorn Gustavsson 2022년 6월 10일
True, but explicitly calling legend with the plot-handles has additional benefits in terms of what to include, which is not necessary in this case but will eventually pop up.

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

카테고리

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