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

6 views (last 30 days)
suga
suga on 31 Jul 2018
Commented: suga on 7 Aug 2018
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 Comments
michio
michio on 31 Jul 2018
コード部分編集しました。
suga
suga on 31 Jul 2018
お手数おかけしました、ありがとうございます。

Sign in to comment.

Accepted Answer

Hirokazu Tanaka
Hirokazu Tanaka on 2 Aug 2018
MATLAB Answersの他のエントリーですが
の 7. Example 5: Overlay Multiple Axes with Differing Colormaps in a Single Figure の例が参考になるかもしれません。Axes(座標軸)オブジェクト上には 1 つのしか colormap を定義できないので、2つの Axesオブジェクトを重ねる方法がよいのではと思います。
  1 Comment
suga
suga on 7 Aug 2018
ご回答頂きありがとうございます。大変参考になりました。
一つのaxesには一つのcolormapしか定義できないこと、そしてリンク先を読み、r2014a以降では軸ごとにcolormapを定義できることを知りました。
私が用いているのはr2013aであり、目的とする描画はできませんでしたが、知識を得ることができてよかったです。

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!