1
$\begingroup$

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?

$\endgroup$

    1 Answer 1

    2
    $\begingroup$
    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") 
    $\endgroup$

      Start asking to get answers

      Find the answer to your question by asking.

      Ask question

      Explore related questions

      See similar questions with these tags.