Color lines in a parallel coordinates plot according to the value of a column
7 views (last 30 days)
Show older comments
I have a database with patients, the date they were treated, the date my algorithm says they should have been treated and the value of their priority in an index between 0 and -1 where -1 is the highest priority.
I have divided the priorities into 5 groups in a column with numbers from 1 to 5 and I would like the lines of each patient to be of a color depending on this last column, for example priority 1 red and priority 2 orange. Another option would be to paint the lines in different colors but to keep them the same color from start to finish for each patient, this would be the option that would please me the most. the intention is that the lines can be differentiated from each other for the reader. I attach the photo that being all the lines from beginning to end of the same color make it very complex.
the lines can be differentiated from each other for the reader.0 Comments
Accepted Answer
Cameron
on 5 Jan 2023
Edited: Cameron
on 5 Jan 2023
I don't know what your data looks like so I'm going to make up some of my own
load patients
X = [Age Height Weight Smoker Systolic];
OneThroughFiveArray = [randi(size(X,2),size(X(:,1),1),1)]; %create some random data 1-5
OneThroughFivePriority = "Priority " + num2str(OneThroughFiveArray);
[~,b] = sort(OneThroughFivePriority);
p = parallelplot(X(b,:));
p.GroupData = OneThroughFivePriority(b);
p.Color(1,:) = [1,0,0]; %red
p.Color(2,:) = [1,0.6,0]; %orangish
p.Color(3,:) = [0.8,1,0]; %yellow green
p.Color(4,:) = [0,1,0]; %green
p.Color(5,:) = [0,0,1]; %blue
More Answers (0)
See Also
Categories
Find more on Animation 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!