How to generate a Color map programmatically with custom color-ranges, save it, and insert more colors later?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 6 de Ag. de 2018
Respondida: MathWorks Support Team
el 4 de Sept. de 2018
How do I define a color map programmatically without having to use the Color map editor UI interface, and get the same beautiful result?
I want to be able to define custom ranges in the color map, and save it to a file for re-use.
Can I also programmatically insert colors at specific index locations in an existing colormap?
For example, I want to make a colormap with the following colors at the following indices:
Index : Color
0 : Blue
50 : Cyan
120 : Magenta
160 : Maroon
255 : Black
Now, after creating this colormap, I want to insert two more colors into this colormap:
Index : Color
180 : Grey
255 : Pink
How can I do this programmatically, without having to use colormapeditor?
Respuesta aceptada
MathWorks Support Team
el 6 de Ag. de 2018
Please find the 3 attached files, that fully describes how to achieve this functionality.
The general idea is to use the "interp1" function to linearly interpolate the RGB values between the given indices.
The 3 files are:
createColorMap.m : This function file is used to generate a Color Map, given a set of indices and RGB colors
insertColorIntoColorMap.m : This function file is used to insert RGB colors at specific indices within an existing colormap
exampleColorMapGeneration.m : This is an example script showing how to utilize these functions for the example given in the question.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Blue 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!