変数に応じてplotの色を変更する方法
31 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Kikuchi
am 26 Jan. 2024
Verschoben: Kojiro Saito
am 27 Jan. 2024
ある変数に応じて2次元プロットの色を変更する方法を教えてください。
例えば、あるGPSの軌跡X(緯度)、Y(経度)のデータと、その時の加速度Zのデータがあります。
X,Yのデータをプロットして、走行軌跡を表示させるときに、
Zの値が+(加速)の時は赤、ー(減速)の時は青といったプロットをしたいです。
また、Zがー(減速)の時のプロットの数はいくつか、自動で算出させたいです。
初心者なので申し訳ありませんが、よろしくお願いします。
2 Kommentare
Akzeptierte Antwort
Atsushi Ueno
am 26 Jan. 2024
Verschoben: Atsushi Ueno
am 26 Jan. 2024
上記は説明用で、単に2次元でプロットしたいなら下記でOKです。
t = 0:0.01:99.99;
x = sin(2*t);
y = cos(3*t);
z = (sin(8*t) > 0) * 2 - 1;
scatter(x,y,5,z,'filled');
colormap([1,0,0; 0,0,1]);
3 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Blue finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!