subplotで異な​る色のカラースケール​を使用する方法

21 vues (au cours des 30 derniers jours)
anaconpa
anaconpa le 4 Déc 2021
subplotで複数のカラーマップを表示するときに,それぞれ別のカラースケールを使用することはできますか?
以下の疑似コードのように1つ目をjet,2つ目をcoolにしたい場合,以下のタイミングでcolormapを呼ぶとすべてのカラースケールがcoolに変わってしまいます.
よろしくお願いいたします
subplot(2,1,1)
imagesc(..)
colormap(jet)
subplot(2,1,2)
imagesc(..)
colormap(cool)% ←このタイミングでsubplot(2,1,1)もcoolに変わってしまう

Réponse acceptée

Atsushi Ueno
Atsushi Ueno le 4 Déc 2021
% The trick is to use gca as the target in colormap.
% そのコツは、colormapのターゲットとしてgcaを使うことです。
% ターゲット。次の値のいずれかとして指定します。
% Figure オブジェクト。Figure のカラーマップは、Figure 内のすべての座標軸のプロットに適用されます。
% Axes オブジェクト、PolarAxes オブジェクト、または GeographicAxes オブジェクト。Figure 内の異なる座標軸に対して、固有のカラーマップを定義できます。
% Colormap プロパティをもつグラフィックス オブジェクト。たとえば、HeatmapChart オブジェクトのカラーマップの変更またはクエリができます。
load penny.mat
subplot(2,1,1)
imagesc(P)
colormap(gca,'jet') % colormap(jet)
subplot(2,1,2)
imagesc(P)
colormap(gca,'cool') % colormap(cool)% ←このタイミングでsubplot(2,1,1)もcoolに変わってしまう

Plus de réponses (0)

Catégories

En savoir plus sur カラーマップ dans Help Center et File Exchange

Tags

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!