凡例の表示順はどうしたら変更できますか?
33 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 14 Juin 2016
Réponse apportée : MathWorks Support Team
le 14 Juin 2016
プロットの凡例は通常データをプロットした順に表示されますが、任意の順番で表示せることはできますか?
Réponse acceptée
MathWorks Support Team
le 14 Juin 2016
プロットの凡例の順序は通常、データをプロットした順番と一致しますが、legend 関数実行時に順番を指定する ことができます。
それぞれのオブジェクトのハンドルを、表示されたい順番に legend 関数の第一引数として与えます。
figure(1)
hold on
h0 = plot(rand(5,1),'red');
h1 = plot(rand(5,1)+1,'blue');
h2 = plot(rand(5,1)+2,'black');
legend([h0,h2,h1], 'data0','data2','data1'); % h0, h2, h1 の順番で凡例を作成
hold off
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Legend dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!