title: Saving plots to pdf files using matplotlib
body: <p>I want to save more than 1 plot to a pdf file. Here is my code:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  from matplotlib.backends.backend_pdf import PdfPages
  
  def function_plot(X,Y):
      plt.figure()
      plt.clf()
  
      pp = PdfPages('test.pdf')
  
      graph = plt.title('y vs x')
      plt.xlabel('x axis', fontsize = 13)
      plt.ylabel('y axis', fontsize = 13)
      pp.savefig(graph)
  
  
  function_plot(x1,y1)
  function_plot(x2,y2)
  </code></pre>
  
  <p>I know that my ideas are scrambled but I can't find the way to write my code. The thing is that I need my graphs to have labeled x and y axis.</p>