How to invert contourf(data,[threshold threshold],'k') and modify color

13 ビュー (過去 30 日間)
Markus Gschwind
Markus Gschwind 2015 年 12 月 20 日
コメント済み: Markus Gschwind 2015 年 12 月 21 日
Dear Experts,
I need to make contours around significant peaks (statistical values presented with imagesc or pcolor), and whiten the thoughs between the peaks.
contourf(2Dmatrix,[threshold threshold],'k')
does almost what I want...
... but it comes the wrong way round: It makes a threshold and covers the hill of the peak with some color and encloses it with the black line.
I would need to keep the hills uncovered, but to cover the thoughs, with white color of 0.4 transparency.
Any ideas how to achieve this?
Thanks in advance!
Markus

採用された回答

Walter Roberson
Walter Roberson 2015 年 12 月 20 日
Perhaps
AlphaMask = double(TwoDmatrix < threshold);
whitecover = ones(size(TwoDMatrix, 1), size(TwoDMatrix, 2), 3);
image(whitecover, 'AlphaData', AlphaMask);
  3 件のコメント
Walter Roberson
Walter Roberson 2015 年 12 月 20 日
I should have said
AlphaMask = 0.4 * double(TwoDMatrix < threshold);
whitecover = ones(size(TwoDMatrix, 1), size(TwoDMatrix, 2), 3);
image(whitecover, 'AlphaData', AlphaMask);
after which you can
contour(TwoDMatrix, [threshold threshold], 'k')
Markus Gschwind
Markus Gschwind 2015 年 12 月 21 日
Works perfectly! Thank you very much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by