Filter löschen
Filter löschen

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

7 Ansichten (letzte 30 Tage)
Andrew
Andrew am 30 Jul. 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

Akzeptierte Antwort

Oleg Komarov
Oleg Komarov am 30 Jul. 2012
Bearbeitet: Oleg Komarov am 30 Jul. 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)])

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by