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

28 次查看(过去 30 天)
anaconpa
anaconpa 2021-12-4
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に変わってしまう

采纳的回答

Atsushi Ueno
Atsushi Ueno 2021-12-4
% 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に変わってしまう

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 カラーマップ 的更多信息

标签

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!