Construct boundaries (as a polygon) in excel chart for a custom data

ajaysomasi

New Member
Joined
Mar 6, 2017
Messages
25
Hi, I have a task to construct polygon boundaries for specific data.. Have a large number of such polygons to construct hence any help as a VBA or directly in excel is much appreciated. I was trying to construct a polygon using scatter plot but the lines are joining to points that will form a boundary. I tried sorting the data to bring a polygon, but guess I'm missing something.. VBA should help but cant code.. I need a standard code that I can run as there are many such boundaries to be constructed.

Datapoints are shown below.. Please help..

-Ajay

X
Y
6
10
10
7
7
15
3
13
25
15
14
12
8
4
21
31
14
16
2
5

<tbody>
</tbody>
 
PGC -

Yeah, I saw what you were doing, but from the original it wasn't really clear to me what was the end product.
 
Upvote 0

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hey guys, it's still an interesting discussion (IMHO), even if we don't know that it's relevant to what the OP actually wanted ! :)

Jon, one thing that I think is worth stressing with your solution (which you did hint at) is that the shape of the polygon depends on the sequencing of the points.
In your example, you've essentially determined the sequencing yourself in such a way that a reasonably pleasing polygon is created.
But any number of slightly different polygons could also be generated by shifting one or two points up or down in the sequence.

If the question is really "How do I generate a polygon where every set of given co-ordinates is a vertice on the polygon" then we need to address sequencing somehow.
The sequencing might be a logical feature of the data - for example time.
If not, then we either need to build an algorithm for doing it, or manually select the sequence by making what are essentially arbitrary aesthetic decisions, or we need to leave it random, which generates a big mess.

Sticking with the original 10 data points (and duplicating the first/last one as Jon did) . . .

This sequence generates a different polygon which is arguably just as valid as Jon's
XY
313
715
1412
1416
2131
2515
107
84
25
610
313

<colgroup><col span="2"></colgroup><tbody>
</tbody>


And this sequence has the position of all points (except the first and last) randomised, and generates "a big mess".
XY
313
2131
1416
25
610
1412
2515
107
84
715
313

<colgroup><col span="2"></colgroup><tbody>
</tbody>


Is there an algorithm of some kind for generating an acceptable polygon like this ?
 
Upvote 0
Is there an algorithm of some kind for generating an acceptable polygon like this ?

Hi

Just a comment.

If you don't go with the convex solution then you have many possible solutions.

They are not necessary a big mess, but they may be different and, I'd say, equally acceptable.

For ex., just 4 points: (0,0), (1,1), (2,1), (0,2)

Solution 1:

0 0
1 1
2 1
0 2
0 0

Solution 2:

0 0
2 1
1 1
0 2
0 0

I don't think one is more "acceptable" than the other. They are just different.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,606
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top