Effacer les filtres
Effacer les filtres

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

5 vues (au cours des 30 derniers jours)
yuya inatomi
yuya inatomi le 30 Jan 2018
Commenté : yuya inatomi le 30 Jan 2018
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) にするにはどうすればいいでしょうか。

Réponse acceptée

Akira Agata
Akira Agata le 30 Jan 2018
等高線のラベルを付ける位置をマウスで指定する必要がありますが、たとえば下記のようにするとラベルを指数表示にすることができます。
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 commentaire
yuya inatomi
yuya inatomi le 30 Jan 2018
ありがとうございます!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!