How do I set the same color scheme for two different plots?

7 ビュー (過去 30 日間)
Andrew
Andrew 2012 年 7 月 30 日
I want the following graphs to not look the same. I want the lowest color (blue) to be bmin and the highest color (red) to be fmax for both graphs.
clear
clf
close all
clc
b = magic(9) + 20*ones(9);
f = magic(9) + 100*ones(9);
bm = max(b);
bmax = max(bm);
bmin = min(b);
bmin = min(bmin);
fm = max(f);
fmax = max(fm);
fmin = min(f);
fmin = min(fmin);
pcolor(f)
colorbar
figure
pcolor(b)
colorbar

採用された回答

Oleg Komarov
Oleg Komarov 2012 年 7 月 30 日
編集済み: Oleg Komarov 2012 年 7 月 30 日
Use caxis to set a fixed color scale
pcolor(f)
caxis([0,200])
colorbar
figure
pcolor(b)
caxis([0,200])
colorbar
You can determine the min and max of the color scale dynamically with
caxis([min(fmin, bmin) max(fmax,bmax)])

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by