Scatter plot with different colours,

1 view (last 30 days)
I have various audio files in hard disc that are being analyzed individually and the results should be plots. Some audio files come from the same source (musical instruments) and have similar names (first 4 letters are similar). I like plotting similar instruments (with simalar names on the hard disc) with the same colors. How should I create this color array?

Accepted Answer

Walter Roberson
Walter Roberson on 22 May 2022
[~, basenames] = fileparts(FileNames);
First4 = cellfun(@(S) S(1:4), basenames, 'uniform', 0);
G = findgroups(First4);
nG = max(G);
colors = YourColormapNameSuchAsJet(nG);
Now for the K'th file, use colors(K,:) as the color entry for scatter purposes.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!