# scatterplot

조회 수: 16 (최근 30일)
jessica david . 2011년 3월 18일
답변: Tasos Giannoulis . 2017년 1월 25일
is there any way to get the (x,y) coordinates of a scatterplot.

댓글을 달려면 로그인하십시오.

### 채택된 답변

Andrew Newell 2011년 3월 18일
You have to dig down a couple of layers to find the data:
h = scatterplot(rand(20,2));
h = get(h,'Children');
h = get(h,'Children');
x = get(h,'xdata');
y = get(h,'ydata');

댓글을 달려면 로그인하십시오.

### 추가 답변 (2개)

Tasos Giannoulis 2017년 1월 25일
SCATTERPLOT returns a handle to the figure. The child of the figure is the "Axes", whose child is a "Line" (even though the Line object has markers only, with no lines connecting them). The Line object has the X and Y values:
h = scatterplot(awgn(2*randi([0 1], 10, 1)-1, 20));
x = h.Children.Children.XData;
y = h.Children.Children.YData;
While this answers the question, I wonder why you want to get the XData/YData from the plot, given that these were the input of the SCATTERPLOT function at the first hand. You can separate the complex number to its real and imaginary parts using the REAL and IMAG functions.
If you were looking for the coordinates of the figure window instead, you can use:
h.Position
##### 댓글 수: 0표시 이전 댓글 수: -1숨기기 이전 댓글 수: -1

댓글을 달려면 로그인하십시오.

Walter Roberson 2011년 3월 18일
get() the XData and YData properties from the plot handle.
##### 댓글 수: 3표시 이전 댓글 수: 2숨기기 이전 댓글 수: 2
Matt Fig 2011년 3월 18일
According to the doc, SCATTERPLOT returns the handle to the figure, which seems very strange to me. However, you might still be able to find the data with FINDALL.
H = findall(0,'type','line')
and if this doesn't find it, you will have to call FINDALL with only the 0 and look at each element of H to find which one has the data.

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Graphics Object Identification에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!