Hello I have a matrix
A=[
1 1 1;
1 1 2;
1 1 3;
1 2 1;
1 2 2;
1 2 3;
2 1 1;
2 1 2;
2 1 3;
2 2 1;
2 2 2;
2 2 3]
containing the Cartesian Product of the elements of the vectors V1 = [1 2], V2 = [1 2], V3 =[1 2 3]
In particular each row of the matrix A
is a combination of the elements of V1 V2 V3
Now I would like to create a color map in blue scale where the very light blue correspond to the 1st row [1 1 1]
and the very dark blue correspond to the 12th row [2 2 3]
.
My questons:
1) How do I order the intermediate rows in a smart way such as they take intermediate blues? (summing over the rows?)
2) How can I create such blue color map?
Thanks!!!
See if this works for you -
Output -
For verification, you can look at the values of
So, that
[1 1 2]
belongs to the same group of[2 1 1]
, as both of theirsorted_sumcols
values are4
at their row numbers2
and4
.Edit
This section of code extends the earlier code to keep same intensity (column-3) for same group elements -
Output -