Change colours of specific points in a scatter plot that has already been plotted?
4 ビュー (過去 30 日間)
古いコメントを表示
David Haydock
2020 年 8 月 17 日
コメント済み: David Haydock
2020 年 8 月 17 日
I have a dimensionality reduction algorithm that extracts latent variables from a dataset and visualises one latent variable with three subplots. The third of the three subplots is a scatter plot, and I want to change the colours of some of the points in this scatter plot.
I know what the indexes of the points that I want to change the colour of are, but I cannot just plot one set one colour and then another set another colour, because the plots are generated from a 3rd order tensor, and are not just datapoints.
Hence I ask: is it possible for me to change colours the datapoints in the plot, after they have been plotted?
5 件のコメント
採用された回答
Abdolkarim Mohammadi
2020 年 8 月 17 日
Take a look at gscatter().
2 件のコメント
Abdolkarim Mohammadi
2020 年 8 月 17 日
編集済み: Abdolkarim Mohammadi
2020 年 8 月 17 日
You can first extract XData and YData of the figure you want, then create a grouping variable, where, for example, intact points are in group 1 and recolored points are in group 2, then you clear the axes, and draw your own scatter plot using gscatter().
Ax = subplot (3,3, 3);
X = Ax.Children(1).XData;
Y = Ax.Children(1).YData;
Grouping = ones (NumPoints,1);
Grouping (RecoloredPointsIndexes) = 2;
cla;
GscatterHdl = gscatter (X,Y,Grouping);
GscatterHdl(1) = 'b';
GscatterHdl(2) = 'g';
Next you do the same for
Ax = subplot (3,3, 6);
and
Ax = subplot (3,3, 9);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Distribution Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!