필터 지우기
필터 지우기

add data information with scatter or plot

조회 수: 14 (최근 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 CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by