how to get/extract x,y values from scatter function
6 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I am currently plotting the X,Y coordinates using scatter function as below.
scatter(x(:,1),x(:,2),[],x(:,3),'filled')
I would like to get the x,y value which is being plotted with different colors, could you please do help me out here.
thank you.
0 件のコメント
採用された回答
Bhaskar R
2020 年 3 月 5 日
You need to apply thresholding to the 3rd column of the x variable upto blue colour as it is normalized colour. If you apply colourbar to the plot you can get idea how to choose threshold value
Demo:
>> x = rand(10, 2); % X, Y data
>> x(:, 3) = 1:10; % colour data where 1 indicates complete blue, 2 - somewhat diluted colour so it is normalized
>> ax = scatter(x(:,1),x(:,2),[],x(:,3),'filled');colorbar;
If you see the colorbar is the axes upto 5 level values are blue as you require, so get the values using CData properties of ax
>> x_values = ax.XData(ax.CData <5);
>> y_values = ax.YData(ax.CData <5);
Hope you get my point
3 件のコメント
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Scatter Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!