Is there a way to sort a set of co-ordinates in a top-to-bottom, left-to-right precedence as they appear?
I eventually ended up using the product of the X and Y coordinates as the sorting key. It worked for my test cases!
I have a list of XY co-ordinates, and I am looking for a way to sort them as they appear on the plot with top-to-bottom, left-to-right precedence.
I tried sorting them as a tuple in Python but it didn't work.
Here are the (normalized) co-ordinates:
(0.48425699105850684, 0.4852200502470339)
(0.8003207976544613, 0.1794844315136523)
(0.663158173206857, 0.19739922702645016)
(0.26770425263394393, 0.20288883507443173)
(0.5214529814719886, 0.2032096846467844)
(0.4768268032594222, 0.3875097802042241)
(0.5400594055964151, 0.5870619715600098)
(0.5445470099105095, 0.8064964338255158)