how to get/extract x,y values from scatter function
14 ビュー (過去 30 日間)
I am currently plotting the X,Y coordinates using scatter function as below.
I would like to get the x,y value which is being plotted with different colors, could you please do help me out here.
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
>> 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