コンターマップのカラーバーのラベルの変更
Show older comments
SubplotとFor文で、カラーバーのラベル名を順番に設定しようとしましたがうまくいきません。
2×2のコンターマップのカラーバーの変数を変えようとしましたが、
最後(2,2)セルのグラフのカラーバーの変数だけが順番に更新され、
他のセル位置のグラフのカラーバーの変数は固定されてしまいます。
すみませんが、ご教授いただけると幸いです。
コードは、下記になります。
for i=1:4
~~~~~省略
Cbar(i)=colorbar;
Cbar(i).Label.String=char(Variable(Vz(i)));←Variableはラベル名が格納された行列です。
2 Comments
Takumi
on 5 Aug 2020
質問の内容を再現してみましたが,正常に更新されます.
エラーを完全に再現できるコードを掲示していただけますとより良い回答ができます.
[X,Y,Z] = peaks;
Variable = {'label1','label2','label3','label4'};
for i=1:4
figure(1)
subplot(2,2,i);
contour(X,Y,Z,i*10);
Cbar(i)=colorbar;
Cbar(i).Label.String = Variable{i};
end
Shinij Kumagai
on 5 Aug 2020
Accepted Answer
More Answers (1)
Shinij Kumagai
on 7 Aug 2020
0 votes
Categories
Find more on 2 次元および 3 次元プロット in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!