title: how to use matplotlib PATH to draw polygon
body: <p>I have a problem when using python's matplotlib PATH modules
  I want to draw a close poly like this:</p>
  
  <p><img src="https://i.stack.imgur.com/obFWB.png" alt="enter image description here"></p>
  
  <p>but I don't know exactly the sequence of the points to be connected and it turned out the result images can't meet my needs. How can I draw a polygon correctly without determining the sequence by myself but by the code?</p>
  
  <p>here is my code:</p>
  
  <pre><code>import matplotlib
  import matplotlib.pyplot as plt
  import pandas
  from matplotlib.path import Path
  import matplotlib.patches as patches
  #read data
  info = pandas.read_csv('/Users/james/Desktop/nba.csv')
  info.columns = ['number', 'team_id', 'player_id', 'x_loc', 'y_loc', 
  'radius', 'moment', 'game_clock', 'shot_clock', 'player_name', 
  'player_jersey']
  
  #first_team_info
  x_1 = info.x_loc[1:6]
  y_1 = info.y_loc[1:6]
  matrix= [x_1,y_1]
  z_1 = list(zip(*matrix))
  z_1.append(z_1[4])
  n_1 = info.player_jersey[1:6]
  verts = z_1
  codes = [Path.MOVETO,
       Path.LINETO,
       Path.LINETO,
       Path.LINETO,
       Path.LINETO,
       Path.CLOSEPOLY,
       ]
       path = Path(verts, codes)
       fig = plt.figure()
       ax = fig.add_subplot(111)
       patch = patches.PathPatch(path, facecolor='orange', lw=2)
       ax.add_patch(patch)
       ax.set_xlim(0, 100)
       ax.set_ylim(0, 55)
       plt.show()
  </code></pre>
  
  <p>and I got this:</p>
  
  <p><img src="https://i.stack.imgur.com/jpiw2.png" alt="enter image description here"></p>