Create a specular colormap

1 view (last 30 days)
Maria445
Maria445 on 15 Mar 2019
Edited: Adam on 15 Mar 2019
I'm using the patch function with a "hot" colormap.
However, I'd like the colormap to be specular; namely I'd like it to be centered on zero and have the same color for positive and negative values with the same absolute value.
Is it possible to do it?

Accepted Answer

Adam
Adam on 15 Mar 2019
Edited: Adam on 15 Mar 2019
figure; imagesc( rand(100) - 0.5 ); % Random data centred on 0
baseCmap = hot( 256 );
cmap = [ flip( baseCmap(2:end,:) ); baseCmap ];
colormap( cmap )
caxis( [-0.5 0.5] )

More Answers (0)

Categories

Find more on Colormaps in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!