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

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

Iniciar sesión para comentar.

Respuesta aceptada

Jiro Doke
Jiro Doke el 2 de Ag. de 2017
Editada: Jiro Doke el 2 de Ag. de 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 comentario
denpika
denpika el 2 de Ag. de 2017
ご回答ありがとうございます。お陰様で解決しそうです。

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre カラーマップ en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!