How to scale the range of a custom colormap correctly?

36 visualizaciones (últimos 30 días)
Thomas Taufan
Thomas Taufan el 5 de Jun. de 2020
Editada: Adam Danz el 7 de Jun. de 2020
I have made a custom colormap manually and I need it to be scaled from -1 to 1, in the result I got it is scaled from about -0.25 to 0.45.
This is the right scale for the custom colormap.
I have saved the variable of the colormap manually by inputting it to a variable. For example :
custom = [ 0 1 1
1 0 0
1 0 1];
How can I save it so that I could use the colormap like other presets anywhere, for example :
colormap(jet);

Respuesta aceptada

Adam Danz
Adam Danz el 5 de Jun. de 2020
Use caxis(limits) to scale the colormap limits of the axes. I also recommend including the optional axis handle input (see documentation within the link).
More info on color scaling:
  3 comentarios
Thomas Taufan
Thomas Taufan el 6 de Jun. de 2020
Editada: Thomas Taufan el 6 de Jun. de 2020
Do you know how to save the custom color map to a variable like jet, winter, parula, etc?
Adam Danz
Adam Danz el 7 de Jun. de 2020
Editada: Adam Danz el 7 de Jun. de 2020
Hmmm, not sure I understand. If you created a custom colormap (nx3 matrix) you must have saved it to a variable such as (fake color map),
cmap = rand(256,3);
or
cmap = jet(256);

Iniciar sesión para comentar.

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