symmetric color map using surf

Hi there,
I would like to show in a graph a symmetric color driving from 0 green to either + and - to red. The peak at the bottom should be in colour yellow again.
All areas around 0 in green. Anyone an Idea? Cheers
AddColorbarToGraphExample_01.png

2 comentarios

KSSV
KSSV el 6 de Mzo. de 2019
Make your colormap data and try..read bout colormap
Peter Wagner
Peter Wagner el 7 de Mzo. de 2019
Thanks! colormap worked!

Iniciar sesión para comentar.

 Respuesta aceptada

Akira Agata
Akira Agata el 7 de Mzo. de 2019
Like this?
cmap = interp1([-1;0;1],[1 0 0;0 1 0;1 0 0],linspace(-1,1)');
surf(peaks)
colormap(cmap)
colorbar
surf.png

Más respuestas (1)

Neil Lamas
Neil Lamas el 9 de Feb. de 2022
Editada: Neil Lamas el 9 de Feb. de 2022
Here is an alternative using the color libraries from matlab:
cmap_pos = jet(64);
cmap_neg = flipud(cmap_pos);
cmap = [cmap_neg; cmap_pos];
surf(peaks)
colormap(cmap)
colorbar

Categorías

Etiquetas

Preguntada:

el 6 de Mzo. de 2019

Editada:

el 9 de Feb. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by