title: Sorting list of two-dimensional coordinates by clockwise angle using Python?
body: <p>I have a set of points with x and y coordinates that can be seen in the figure below. The coordinates of the 9 points were stored in a list as follows:</p>
  
  <pre><code>L = [[5,2], [4,1], [3.5,1], [1,2], [2,1], [3,1], [3,3], [4,3] , [2,3]]
  </code></pre>
  
  <p>The idea is to sort the points clockwise from an origin. In this case, the origin is the point that is colored and that has an arrow that indicates the direction of the ordering. Do not worry about creating methodology to determine the origin because it is already solved.</p>
  
  <p>Thus, after being ordered, the list <code>L</code> should be as follows:</p>
  
  <pre><code>L = [[2,3], [3,3], [4,3], [5,2], [4,1], [3.5,1], [3,1], [2,1], [1,2]]
  </code></pre>
  
  <p>Note that the x and y coordinates are not changed. What changes is the storage order.</p>
  
  <p>Do you have any idea of an algorithm, script or methodology for this problem in the python language?</p>
  
  <p><img src="https://i.stack.imgur.com/6DqZw.jpg" alt="figure 1"></p>