title: How to make a polygon radar (spider) chart in python
body: <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  
  labels=['Siege', 'Initiation', 'Crowd_control', 'Wave_clear', 'Objective_damage']
  markers = [0, 1, 2, 3, 4, 5]
  str_markers = [&quot;0&quot;, &quot;1&quot;, &quot;2&quot;, &quot;3&quot;, &quot;4&quot;, &quot;5&quot;]
  
  def make_radar_chart(name, stats, attribute_labels=labels,
                       plot_markers=markers, plot_str_markers=str_markers):
  
      labels = np.array(attribute_labels)
  
      angles = np.linspace(0, 2*np.pi, len(labels), endpoint=False)
      stats = np.concatenate((stats,[stats[0]]))
      angles = np.concatenate((angles,[angles[0]]))
  
      fig = plt.figure()
      ax = fig.add_subplot(111, polar=True)
      ax.plot(angles, stats, 'o-', linewidth=2)
      ax.fill(angles, stats, alpha=0.25)
      ax.set_thetagrids(angles * 180/np.pi, labels)
      plt.yticks(markers)
      ax.set_title(name)
      ax.grid(True)
  
      fig.savefig(&quot;static/images/%s.png&quot; % name)
  
      return plt.show()
  
  make_radar_chart(&quot;Agni&quot;, [2,3,4,4,5]) # example
  </code></pre>
  <p><a href="https://i.stack.imgur.com/bIpwH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bIpwH.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/XgQDe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XgQDe.png" alt="enter image description here" /></a></p>
  <p>Basically I want the chart to be a pentagon instead of circle. Can anyone help with this. I am using python matplotlib to save an image which will stored and displayed later. I want my chart to have the form of the second picture</p>
  <p>EDIT:</p>
  <pre><code>    gridlines = ax.yaxis.get_gridlines()
      for gl in gridlines:
          gl.get_path()._interpolation_steps = 5
  </code></pre>
  <p>adding this section of code from answer below helped a lot. I am getting this chart. Still need to figure out how to get rid of the outer most ring: <a href="https://i.stack.imgur.com/7VWBh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7VWBh.png" alt="enter image description here" /></a></p>