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

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 CenterFile Exchange 中查找有关 Blue 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by