add data information with scatter or plot

18 ビュー (過去 30 日間)
ELISABETTA BILLOTTA
ELISABETTA BILLOTTA 2021 年 8 月 20 日
コメント済み: Turlough Hughes 2021 年 8 月 21 日
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?

採用された回答

Turlough Hughes
Turlough Hughes 2021 年 8 月 20 日
編集済み: Turlough Hughes 2021 年 8 月 20 日
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 件のコメント
ELISABETTA BILLOTTA
ELISABETTA BILLOTTA 2021 年 8 月 21 日
yes yes thanks :)
Turlough Hughes
Turlough Hughes 2021 年 8 月 21 日
Good stuff. Can you accept the answer in that case.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by