Figure作成時にNaNとInfだけ黒に指定する方法
27 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
ASAKO MORI
le 13 Mar 2019
Modifié(e) : Teja Muppirala
le 14 Mar 2019
matrix(matファイル)をカラーのfigureに変換するとき、NaNとInfだけ黒にしたいときはどうしたらいいんでしょうか?
figure;imagesc(matrix)
colorbar
とすると、単純にNanとInfがMinとMaxの色になってしまいます。
どうぞよろしくお願いします。
0 commentaires
Réponse acceptée
Teja Muppirala
le 14 Mar 2019
Modifié(e) : Teja Muppirala
le 14 Mar 2019
NaNやInfを透明にして、背景を黒にすることは一つにアイディアです。
例えば:
rng(0);
X = peaks(20); % 適当なデータを作成
X(randperm(numel(X),3)) = nan; % 適当にNaNを入れる
X(randperm(numel(X),3)) = Inf; % 適当にInfをを入れる
X(randperm(numel(X),3)) = -Inf; % 適当に-Infをを入れる
figure;
h = imagesc(X);
h.AlphaData = isfinite(X); % NaNやInfを透明にする
h.Parent.Color = 'k'; %背景を黒にする
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur イメージ タイプの変換 dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!