等高線のラベルを指数​表示にするにはどうす​ればいいですか?

조회 수: 2 (최근 30일)
yuya inatomi
yuya inatomi 2018년 1월 30일
댓글: yuya inatomi 2018년 1월 30일
x=linspace(1,3,30);
y=linspace(1,3,30);
[X Y]=meshgrid(x,y);
Z=(X.^2+Y.^2)*1e3;
contour(X,Y,Z,'ShowText','on')
上記コードで画像のような等高線をプロットしたとします。 このときラベルを指数表示(例:4000->4.0x10^3) にするにはどうすればいいでしょうか。

채택된 답변

Akira Agata
Akira Agata 2018년 1월 30일
等高線のラベルを付ける位置をマウスで指定する必要がありますが、たとえば下記のようにするとラベルを指数表示にすることができます。
x = linspace(1,3,30);
y = linspace(1,3,30);
[X Y] = meshgrid(x,y);
Z = (X.^2+Y.^2)*1e3;
[C,h] = contour(X,Y,Z);
t = clabel(C,h,'manual')
set(t,'BackgroundColor',[1 1 1]);
for kk = 1:numel(t)
t(kk).String = sprintf('%.2e',t(kk).UserData);
end
  댓글 수: 1
yuya inatomi
yuya inatomi 2018년 1월 30일
ありがとうございます!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 等高線図에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!