Faq class color custom

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search

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