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

5 次查看(过去 30 天)
yuya inatomi
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 个)

Community Treasure Hunt

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

Start Hunting!