title: Plot matplotlib on the Web
body: <p>The following code will of course create a PNG named test and save it on the server:</p>
  
  <pre><code>from matplotlib.figure import Figure                         
  from matplotlib.backends.backend_agg import FigureCanvasAgg  
  
  fig = Figure(figsize=[4,4])                                  
  ax = fig.add_axes([.1,.1,.8,.8])                             
  ax.scatter([1,2], [3,4])                                     
  canvas = FigureCanvasAgg(fig)                                
  canvas.print_figure("test.png")
  </code></pre>
  
  <p>Then to view the image in the browser, we have to go to example.com/test.png. This means we have to call the page with the Python code first to create the test.png file, then go to the PNG file. Is there a way to draw the PNG and output from the Python page that creates the image? Thanks!</p>