Exporting from matplotlib I'm finding a quicker method to export plots

import numpy as np                                                      
from matplotlib.backends.backend_pdf import PdfPages 
import matplotlib.pyplot as plt

X = ... #define X
with PdfPages('MyFile.pdf') as export_pdf: 
   plt.figure() 
   plt.plot(np.arange(0,60+1), X) 
   plt.xlabel('t') 
   plt.ylabel('x(t)') 
   plt.title('title') 
   export_pdf.savefig() 
   plt.show() 
   plt.close()


I'm trying to find simpler code than the one I wrote attached. Any advice?
import matplotlib.pyplot as plt
import numpy as np
file = plt.figure()
plt.plot(np.arange(0,60+1), X)
plt.xlabel('t') 
plt.ylabel('x(t)') 
plt.title('title')
plt.show()
file.savefig("MyFile.pdf")