add data information with scatter or plot

17 vues (au cours des 30 derniers jours)
ELISABETTA BILLOTTA
ELISABETTA BILLOTTA le 20 Août 2021
Commenté : Turlough Hughes le 21 Août 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?

Réponse acceptée

Turlough Hughes
Turlough Hughes le 20 Août 2021
Modifié(e) : Turlough Hughes le 20 Août 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 commentaires
ELISABETTA BILLOTTA
ELISABETTA BILLOTTA le 21 Août 2021
yes yes thanks :)
Turlough Hughes
Turlough Hughes le 21 Août 2021
Good stuff. Can you accept the answer in that case.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Scatter Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by