Connecting the Dots for a Scatter Plot

조회 수: 16 (최근 30일)
Jeff
Jeff 2013년 5월 2일
Hey everyone. I need to draw a line through a scatter plot. The vector array that I'm giving the scatter function is not in order though (so, there isn't any connection between say VectorItem(1,:) and VectorItem(2,:). Basically I want to turn this image into the following image
Thanks!

답변 (3개)

Shashank Prasanna
Shashank Prasanna 2013년 5월 3일
There is not enough information in just the two vectors to draw that line. There seems to be some other detail that is missing, such as on what criterion do you decide to exclude the island on the top right. If you are aware of any other information or what generated your existing image that would be helpful.
If you want a function that computes an enclosure then you could try convex hull:
  댓글 수: 1
Image Analyst
Image Analyst 2013년 5월 3일
You don't want convex hull, you want concave hull. See my answer.

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


Walter Roberson
Walter Roberson 2013년 5월 3일
If you wrote the dots into a data matrix, and then did an imdilate() followed by thinning the image, and then labeled the image -- then you could ask for the regionprops for the boundary pixel list of each region.
There might well be a better way. There probably is.

Image Analyst
Image Analyst 2013년 5월 3일
I already gave you the code for a "concave hull" (or "restricted convex hull") ( http://grasswiki.osgeo.org/wiki/Create_concave_hull in this link: http://www.mathworks.com/matlabcentral/answers/73617#comment_146191. That code creates a binary image. So once you have the binary image, you simply call bwboundaries() to get the ordered list of boundary coordinates going around the perimeter of the concave hull.

카테고리

Help CenterFile Exchange에서 Bounding Regions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by