Connecting the Dots for a Scatter Plot

11 visualizzazioni (ultimi 30 giorni)
Jeff
Jeff il 2 Mag 2013
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!

Risposte (3)

Shashank Prasanna
Shashank Prasanna il 3 Mag 2013
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 Commento
Image Analyst
Image Analyst il 3 Mag 2013
You don't want convex hull, you want concave hull. See my answer.

Accedi per commentare.


Walter Roberson
Walter Roberson il 3 Mag 2013
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 il 3 Mag 2013
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.

Categorie

Scopri di più su Bounding Regions in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by