title: What is wrong with my attempt to save my image?
body: <p>I am trying to learn Python.  I am using the following program, which creates the image OK, but I want to save it.  I tried some instructions I found on this site, but am getting the error message at the bottom. Any help would be appreciated.</p>
  
  <p>Program:</p>
  
  <pre><code>import sys
  import random
  import matplotlib as plt
  from graphics import *
  
  def main():
      m=1
      n=2
      offset=50
      win = GraphWin("MyWin",500, 500)
      win.setBackground(color_rgb(0,0,0))
      for i in range(1,1000,1):
          r= random.uniform(0,1)
          q= int(3*r)
          m = (m/2) + q*(q-1)*75
          n = (n/2) + q*(3-q)*75
  
          pt = Point(m + offset,n + offset)
          pt.setOutline(color_rgb(255,255,0))
          pt.draw(win)
  
      print("graphic done")
      plt.savefig("figure.png")
      win.getMouse()
      win.close()
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>Error Message:</p>
  
  <blockquote>
    <p>graphic done<br>
    Traceback (most recent call last):<br>
      File "fractal_1.py", line 29, in &lt;module>
        main()<br>
      File "fractal_1.py", line 24, in main<br>
        plt.savefig("figure.png")<br>
    AttributeError: module 'matplotlib' has no attribute 'savefig'<br></p>
  </blockquote>