How to subtract a scatterplot object from a polyshape object

조회 수: 1 (최근 30일)
Kurt
Kurt 2025년 4월 1일
댓글: Kurt 2025년 4월 10일
In my app I am defining polyshapes that represent satellite scan regions on Earth. I know how to subtract polyshapes from each other, for example along coastlines. Now I have a set of scatterplots that represent things such as sea ice, that I also need to subtract from the polyshape scan regions, something like this:
The pink represents the satellite scan region, and the blue is the scatterplot. I need to subtract the scatterplot area from the polyshape scan region. I know scatterplots do not have "area" per se, but perhaps we can define a boundary?
Is there a way to convert a scatterplot to a polyshape? I have seen several discussions here on scatterplots, but nothing quite like this situation. The closest I have come is this answer:
Thanks!

채택된 답변

Walter Roberson
Walter Roberson 2025년 4월 8일
You can retrieve the XData and YData from the scatter plot, and pass the resulting points to boundary or alphaShape to trace around the outside of the set of points. This will give you a refined set of points that you can use to create another polyshape that you can then subtract from the original polyshape.
  댓글 수: 8
Walter Roberson
Walter Roberson 2025년 4월 10일
Well you could do something like kmeans clustering and select each cluster and boundary() it individually.
... Now you just need a way of automatically determining the correct number of clusters...
Kurt
Kurt 2025년 4월 10일
Is there a way to divide a polyshape into its separate regions? I didn't see anything.

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

추가 답변 (1개)

peak
peak 2025년 4월 1일
편집: Steven Lord 2025년 4월 1일
The scatterplot is shown in blue, while the satellite scan region is shown in pink. The scatterplot area must be subtracted from the polyshape scan region. https://www.mathworks.com/matlabcentral/answers/472879-surface-from-scatter-3-plot
[SL: Removed link that appeared to be unrelated to the question.]
  댓글 수: 1
Kurt
Kurt 2025년 4월 1일
편집: Kurt 2025년 4월 8일
Can you elaborate on this ? I don't see a solution in the link. I'm trying to work with polyshapes, which are not quite the same thing as surface plots.
Also, my scatterplot data contains NaNs, which don't work well with mesh objects.

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

카테고리

Help CenterFile Exchange에서 Elementary Polygons에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by