add data information with scatter or plot

17 visualizaciones (últimos 30 días)
ELISABETTA BILLOTTA
ELISABETTA BILLOTTA el 20 de Ag. de 2021
Comentada: Turlough Hughes el 21 de Ag. de 2021
I created circles like these with the plot and scatter function. but now I have to figure out how I can enter a different value for each point, each star. practically every point / star corresponds to a coordinate (x, y) but also to a value (z) that I have to insert and these z values are all different from each other. I would like to get to the point where by moving the mouse on a particular point / star, both the values of x and y can come out, but also that of z. how can I do?

Respuesta aceptada

Turlough Hughes
Turlough Hughes el 20 de Ag. de 2021
Editada: Turlough Hughes el 20 de Ag. de 2021
Personally, I would just use scatter3 and then look at the data from above (along the z-axis). So something like:
scatter3(x,y,z)
view(0,90)
axis equal
Modifying the datatip labels in a 2d scatter plot is also possible though:
hp = scatter(x,y);
hp.DataTipTemplate.DataTipRows(3) = dataTipTextRow('Z',z);
axis equal
The above code can be tested with the following data:
x = -1:0.1:1;
y = [sqrt(1-x.^2) -sqrt(1-x.^2)];
x = repmat(x,1,2);
z = rand(1,numel(x));
  3 comentarios
ELISABETTA BILLOTTA
ELISABETTA BILLOTTA el 21 de Ag. de 2021
yes yes thanks :)
Turlough Hughes
Turlough Hughes el 21 de Ag. de 2021
Good stuff. Can you accept the answer in that case.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Scatter Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by