Borrar filtros
Borrar filtros

Colorbar with three colors

13 visualizaciones (últimos 30 días)
Yunhui He
Yunhui He el 3 de Oct. de 2017
Respondida: KSSV el 3 de Oct. de 2017
I am using surf plot the pictures. I want to see the colorbar at the right-hand side. But the transition of the color is not so obvious. I want to see from green to red, and there is another color in the middle. How can I do this?
Thanks!
  1 comentario
Walter Roberson
Walter Roberson el 3 de Oct. de 2017
Are there only 3 colors in the plot, or is it that you only want three colors to appear in the colorbar ?
If you are already doing colormap() in order to activate a colormap of three colors, then colorbar() should adjust automatically.

Iniciar sesión para comentar.

Respuesta aceptada

KSSV
KSSV el 3 de Oct. de 2017
Z = peaks(100) ;
surf(Z)
shading interp
cmap = [1 0 0 ; 0 1 0 ; 0 0 1] ;
colorbar
colormap(cmap)

Más respuestas (0)

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by