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

7 vues (au cours des 30 derniers jours)
Andrew
Andrew le 30 Juil 2012
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

Réponse acceptée

Oleg Komarov
Oleg Komarov le 30 Juil 2012
Modifié(e) : Oleg Komarov le 30 Juil 2012
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)])

Plus de réponses (0)

Catégories

En savoir plus sur Blue 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!

Translated by