値の変動を色で表現するグラフの作成方法

22 Ansichten (letzte 30 Tage)
denpika
denpika am 2 Aug. 2017
Kommentiert: denpika am 2 Aug. 2017
添付ファイル上図のような波形の動きを下図のような 色スケールの変化で表せるようなグラフを作成したいのですが、 どのような方法があるでしょうか? サンプルグラフは1を赤、-1を緑にしています。 色の設定方法なども教えていただけると助かります。
  2 Kommentare
michio
michio am 2 Aug. 2017
下記例は patch オブジェクトの色を明示的に指定していますが、一例まで。
他のサンプルプロットはこちらから: MATLAB Plot Gallery
denpika
denpika am 2 Aug. 2017
ご回答ありがとうございます。参考にさせていただきます。

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Jiro Doke
Jiro Doke am 2 Aug. 2017
Bearbeitet: Jiro Doke am 2 Aug. 2017
色スケールは surface コマンドで無理やり作ってみました。例として既定のカラーマップ(parula)を使用しましたが、実際のスケール(1が赤で-1が青、その間は?)が分かれば簡単に変更できると思います。
% データ定義
x = 0:360;
y1 = cos(x*pi/180);
y2 = sin(x*pi/180);
% ラインプロット
subplot(4,1,1:3)
plot(x,y1,x,y2)
set(gca,'XAxisLocation','origin')
xlim([0 360])
box off
legend('系列1','系列2')
% 色スケール
subplot(4,1,4)
surface(0:360,0:1,[y1;y1])
surface(0:360,-1:0,[y2;y2])
shading interp
text(0,0.5,'系列1','HorizontalAlignment','right','VerticalAlignment','middle')
text(0,-0.5,'系列2','HorizontalAlignment','right','VerticalAlignment','middle')
xlim([0 360])
axis off
  1 Kommentar
denpika
denpika am 2 Aug. 2017
ご回答ありがとうございます。お陰様で解決しそうです。

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu カラーマップ finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!