フィルターのクリア

Black mask over pcolor plot

7 ビュー (過去 30 日間)
Nikolay Vinnichenko
Nikolay Vinnichenko 2019 年 12 月 3 日
回答済み: J. Alex Lee 2019 年 12 月 3 日
I have two matrices of the same size. The first one is function of two variables, which is to be displayed using pcolor. But then I need to mask (paint with black) part of this plot using the mask defined by the second matrix (zeros for transparent cells, ones for those to be masked). I need the colorbar and caxis to remain from the main pcolor of the function. How can I do this? I suspect this is something to do with AlphaData property of the second graph, but so far I only see the solutions for imshow, but not for pcolor.

採用された回答

J. Alex Lee
J. Alex Lee 2019 年 12 月 3 日
You can assign NaN in your first matrix according to your mask and set the background of your axes to black:
A = randi(255,200,200);
B = false(200,200);
B(20:30,60:80) = true;
A(B) = NaN;
pcolor(A)
set(gca,'Color','k')

その他の回答 (1 件)

Image Analyst
Image Analyst 2019 年 12 月 3 日
An example of what you'd like to see would be good. In the meantime, check out patch() and fill().

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by