Color Code Plotted Data According to Value in Un-Plotted Column
9 views (last 30 days)
I have a 53x3 matrix of data and I would like to plot the 2nd and 3rd columns color-coded with a colormap according to the value in the first column. The first column has 13 unique values and each unique value appears in varying frequency in the rows.
For example, the matrix
would plot six lines in three different colors, two lines (in color 1) corresponding to 100, one line (in color 2) corresponding to 101, and three lines (in color 3) corresponding to 102. Again, values in the first column would not be plotted but would appear in a legend.
What is the best way to go about doing this?
Srivardhan Gadila on 2 Oct 2020
Also the following code may help you (Note that you may have to make changes according to your usage):
sz = size(data);
for i = 1:sz(1)
function color = getColor(data)
color = [1 0 0];
color = [0 1 0];
color = [0 0 1];