plotmatrix - how to change the color according to one variable in data?
5 ビュー (過去 30 日間)
古いコメントを表示
I have dataset with 5 different variables. I would like to generate plotmatrix where all plots are colored according to the first variable (first variable has values "one" or "two". I used the following code, but all my plots still have the same color.
if Y(:,1) > 1
plotmatrix(Y,'g');
hold on
else plotmatrix(Y,'r');
end
hold off
回答 (3 件)
Adam
2015 年 11 月 26 日
編集済み: Adam
2015 年 11 月 26 日
The final example of
doc plotmatrix
shows how colour individual plots if that is what you are aiming to do (at least in the help for R2015b and it mentions the notation change for R2014a so I assume it has been there for a few versions).
I haven't followed the steps myself, but one of the graphs shown has a different colour to the rest.
3 件のコメント
Matthieu Heitz
2017 年 7 月 17 日
The function 'gplotmatrix()' does this exactly, pass your first column of labels as the 'group' parameter. You need the Statistics and MachineLearning Toolbox though.
Stephen23
2017 年 7 月 17 日
plotmatrix(Y(Y(:,1)==1,:),'g');
hold on
plotmatrix(Y(Y(:,1)==2,:),'r');
0 件のコメント
Tobias Held
2022 年 2 月 28 日
I was looking for the same function, but with a continuous scale. However, I was not able to find an answer and made a function myself. I am happy to receive feedback :)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!