how to get/extract x,y values from scatter function
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
SatyaPrakash Gupta
el 4 de Mzo. de 2020
Comentada: SatyaPrakash Gupta
el 6 de Mzo. de 2020
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 comentarios
Respuesta aceptada
Bhaskar R
el 5 de Mzo. de 2020
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 comentarios
Más respuestas (1)
Ver también
Categorías
Más información sobre Scatter Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!