Getting particular scatter plots

조회 수: 3 (최근 30일)
Hari
Hari 2016년 5월 2일
답변: Mike Garrity 2016년 5월 2일
This is a picture of a scatter plot that I have plotted over an image from my raw data. I want to know the coordinates of the points that are inside the rectangle box that I have drawn. The raw data containing coordinates of all the scatter points is huge. So, is it possible to extract the coordinates of those group of points from the raw data alone somehow? Thank you!

답변 (1개)

Mike Garrity
Mike Garrity 2016년 5월 2일
Something like this perhaps:
hs = scatter(randn(1,1000),randn(1,1000),'.');
hr = rectangle('Position',[.5 .5 .65 .5]);
minx = hr.Position(1);
maxx = hr.Position(1) + hr.Position(3);
miny = hr.Position(2);
maxy = hr.Position(2) + hr.Position(4);
mask = hs.XData >= minx & hs.XData <= maxx ...
& hs.YData >= miny & hs.YData <= maxy;
x = hs.XData(mask);
y = hs.YData(mask);
hold on
scatter(x,y,'filled')

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by