Someone asked this question elsewhere and was told there was a 'hint' here, but I'm quite new to MATLAB and don't see how to use that hint.
I have a file cmap.mat
. I load it and update the colormap as follows:
load cmap.mat;
colormap(cmap);
But it only works for the current figure. I'd like all figures to use this colormap.
If you have not specified a different default value, then the default colormap is parula .
hsvmap — HSV colormap HSV colormap, returned as a c-by-3 numeric matrix with values in the range [0, 1]. Each row of hsvmap is a three-element HSV triplet that specifies the hue, saturation, and value components of a single color of the colormap.
Open the Colormap Editor MATLAB command prompt: Enter colormapeditor .
To set a default property that all figures will use, you have to set that default value on the root object. Here's some better documentation explaining how to do it. In your case, you would do the following:
set(0,'DefaultFigureColormap',cmap);
In general, the property name you have to set will be the word 'Default'
followed by the handle object name (i.e. 'Figure'
, 'Line'
, 'Surface'
, etc.) followed by the property name you are setting the default for. Once set, subsequent handle objects will be created with that property set to your specified default.
Note: The default property values you set will only last for the current MATLAB session. If you restart MATLAB, the default values will revert to their factory settings. To use the same defaults every time you start MATLAB, apply them within your 'startup.m'
file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With