How to set custom default color map in MATLAB?

Someone asked this question elsewhere , and they told him that there is a “clue” here , but I am completely new to MATLAB and don’t see how to use this hint.

I have a cmap.mat file. I download it and update the color code as follows:

 load cmap.mat; colormap(cmap); 

But it only works for the current shape. I would like all numbers to use this floral card.

+6
source share
1 answer

To set a default property that all shapes will use, you must set this default value for the root object . Here is more detailed documentation explaining how to do this. In your case, you will do the following:

 set(0,'DefaultFigureColormap',cmap); 

In general, the name of the property you must set is the word 'Default' , followed by the name of the handle object (i.e. 'Figure' , 'Line' , 'Surface' , etc.), followed by the name properties for the default installation. After installation, subsequent descriptor objects will be created with the specified property specified by default.

Note. The default property values ​​you set will only be saved for the current MATLAB session. If you restart MATLAB, the default values ​​will revert to factory settings. To use the same default values ​​every time you start MATLAB, apply them in the file 'startup.m' .

+8
source

Source: https://habr.com/ru/post/888344/


All Articles