how does the gplotmatrix color?

3 views (last 30 days)
gplotmatrix(OrigDataReduced,[],FinalAGClasses,[1 0 0; 0 0 0; 1 1 0; 0 0 0; 0 1 1; 0 0 0; 0.4940 0.1840 0.5560; 0 0 0; 0.3010 0.7450 0.9330; 0.6350 0.0780 0.1840; 0 0 0; 0 0 0],[],[20],false);
I want my plots to be colored in a specific order, but I don't understand in what order matlab assigns colors from FinalAGClasses - my numbers are: (I have 130 values with assigned class number).
class No
1 r [1 0 0]
4 k [0 0 0]
5 y [1 1 0]
10 k [0 0 0]
11 c [0 1 1]
16 k [0 0 0]
17 [0.4940 0.1840 0.5560]
18 k [0 0 0]
19 [0.3010 0.7450 0.9330]
20 [0.6350 0.0780 0.1840]
21 k [0 0 0]
22 k [0 0 0]

Accepted Answer

Gaurav Phatnani
Gaurav Phatnani on 1 Feb 2018
>> gplotmatrix(x,y,group,clr,sym,siz,doleg)
The points specified by the 'x' and 'y' arguments of 'gplotmatrix' are categorized in groups using the third argument 'group'.
The points are colored based on the group they fall under. The color assigned to a group is the corresponding element in the 'clr' vector. For example, group 1 will be assigned the color 'clr(1)', group 2 will be 'clr(2)' and so on.
If the number of groups is greater than the number of elements in the 'clr' vector, the sequence repeats itself. For example, if there are 'n' groups and 'm' colors such that n>m then color of group 'm+1' will be 'clr(1)'
  1 Comment
Jasmina Burek
Jasmina Burek on 1 Feb 2018
Thank you. I was confused because I used numbers only first so could not tell if it's by order or number value. But now when I replaced with text it is clear. Thank you

Sign in to comment.

More Answers (0)

Categories

Find more on Get Started with Statistics and Machine Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!