contourfを用​いた塗りつぶし等高線​図の重ねがきについて

contourfを用いたイメージング画像の重ねがきをしようと考えましたが、データごとにカラーマップを変更する方法がわかりません。
例えばx1,x2ともに8×8のイメージングデータであり、それぞれ赤、緑にしたいとき
map1=[1,0,0;0.9,0,0];map2=[0,1,0;0,0.9,0];
contourf(x1,'LineStyle','none');alpha(.001);colormap(map1);hold on
contourf(x2,'LineStyle','none');alpha(.001);colormap(map2);
これだとx2だけでなくx1も緑色になってしまいます。x1を赤、x2を緑に塗りわける方法はありますでしょうか。

2 Commenti

michio
michio il 31 Lug 2018
コード部分編集しました。
suga
suga il 31 Lug 2018
お手数おかけしました、ありがとうございます。

Accedi per commentare.

 Risposta accettata

Hirokazu Tanaka
Hirokazu Tanaka il 2 Ago 2018

1 voto

MATLAB Answersの他のエントリーですが
の 7. Example 5: Overlay Multiple Axes with Differing Colormaps in a Single Figure の例が参考になるかもしれません。Axes(座標軸)オブジェクト上には 1 つのしか colormap を定義できないので、2つの Axesオブジェクトを重ねる方法がよいのではと思います。

1 Commento

suga
suga il 7 Ago 2018
ご回答頂きありがとうございます。大変参考になりました。
一つのaxesには一つのcolormapしか定義できないこと、そしてリンク先を読み、r2014a以降では軸ごとにcolormapを定義できることを知りました。
私が用いているのはr2013aであり、目的とする描画はできませんでしたが、知識を得ることができてよかったです。

Accedi per commentare.

Più risposte (0)

Richiesto:

il 31 Lug 2018

Commentato:

il 7 Ago 2018

Community Treasure Hunt

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

Start Hunting!