コンターマップのカラーバーのラベルの変更
Ältere Kommentare anzeigen
SubplotとFor文で、カラーバーのラベル名を順番に設定しようとしましたがうまくいきません。
2×2のコンターマップのカラーバーの変数を変えようとしましたが、
最後(2,2)セルのグラフのカラーバーの変数だけが順番に更新され、
他のセル位置のグラフのカラーバーの変数は固定されてしまいます。
すみませんが、ご教授いただけると幸いです。
コードは、下記になります。
for i=1:4
~~~~~省略
Cbar(i)=colorbar;
Cbar(i).Label.String=char(Variable(Vz(i)));←Variableはラベル名が格納された行列です。
2 Kommentare
Takumi
am 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
am 5 Aug. 2020
Akzeptierte Antwort
Weitere Antworten (1)
Shinij Kumagai
am 7 Aug. 2020
0 Stimmen
Kategorien
Mehr zu 等高線図 finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!