Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using different colors in Matlab

Tags:

colors

matlab

In a 3D scatter graph of MATLAB I have 15 different clusters of data that I want to highlight. I can see MATLAB has 8 specific colors. Is there any other way I could use 7 more colors just to distinguish the clusters?

Thanks

like image 508
Pow Avatar asked Mar 15 '26 23:03

Pow


1 Answers

I would recommend to use this File Exchange submission - Generate maximally perceptually-distinct colors

It allows you to create a colormap with very distinguished colors and apply them with COLORMAP function. See help for this submission for more options.

colors = distinguishable_colors(n_colors);

For 3D scatter you can use this colors as an argument (C) in SCATTER3:

scatter3(X,Y,Z,[],colors)

To use this colors for different lines set them as default color order either for current figure:

set(gcf,'DefaultAxesColorOrder',colors)

or all figures:

set(0,'DefaultAxesColorOrder',colors
like image 191
yuk Avatar answered Mar 17 '26 14:03

yuk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!