Faq class color custom: Difference between revisions
Jump to navigation
Jump to search
(Created page with "===Issue:=== How can I customize class colors? ===Possible Solutions:=== ===See Also=== Classcolors, Set_Symbol_Styles_Window, Faq_color_order_images") |
No edit summary |
||
Line 4: | Line 4: | ||
===Possible Solutions:=== | ===Possible Solutions:=== | ||
Class colors are managed via the [[classcolors]] function. You can add a user defined color matrix that will then become the default. Here are some examples of how to do this in PLS_Toolbox: | |||
<pre> | |||
%Get the Matlab colormap for perula | |||
cm = colormap('parula'); | |||
%Randomly reorder the map to create contrast between rows | |||
cmm = cm(randperm(256),:); | |||
%Set the color map as default and it will be used when you plot | |||
setplspref('classcolors','userdefined',cmm) | |||
</pre> | |||
In this example the color order is rearranged: | |||
<pre> | |||
%Get default class colors. | |||
clsclr = classcolors; | |||
%Flip the green and red rows. | |||
clsclr(2:3,:) = flipud(clsclr(2:3,:)); | |||
%Set this as default. | |||
setplspref('classcolors','userdefined',clsclr); | |||
</pre> | |||
===See Also=== | ===See Also=== | ||
[[Classcolors]], [[Set_Symbol_Styles_Window]], [[Faq_color_order_images]] | [[Classcolors]], [[Set_Symbol_Styles_Window]], [[Faq_color_order_images]] |
Latest revision as of 18:31, 6 January 2022
Issue:
How can I customize class colors?
Possible Solutions:
Class colors are managed via the classcolors function. You can add a user defined color matrix that will then become the default. Here are some examples of how to do this in PLS_Toolbox:
%Get the Matlab colormap for perula cm = colormap('parula'); %Randomly reorder the map to create contrast between rows cmm = cm(randperm(256),:); %Set the color map as default and it will be used when you plot setplspref('classcolors','userdefined',cmm)
In this example the color order is rearranged:
%Get default class colors. clsclr = classcolors; %Flip the green and red rows. clsclr(2:3,:) = flipud(clsclr(2:3,:)); %Set this as default. setplspref('classcolors','userdefined',clsclr);
See Also
Classcolors, Set_Symbol_Styles_Window, Faq_color_order_images