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

2 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Oleg Komarov
Oleg Komarov el 30 de Jul. de 2012
Editada: Oleg Komarov el 30 de Jul. de 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)])

Más respuestas (0)

Categorías

Más información sobre Colormaps en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by