# Is there any way to integrate matplotlib plots in my latex document using sagetex?

I have used this code to draw a picture using matplotlib.pyplot sagenb plots this nicely but i couldn't get this in my latex document when i use sagetex.

\begin{sagesilent} import matplotlib.pyplot as plt plt.plot([1,2,3,4],[1, 3, 2, 4]) plt.savefig('test.png') \end{sagesilent}

i get this error message:

**** Error in Sage code on line 53 of sagetextest.tex! Traceback follows.
Traceback (most recent call last):
File "sagetextest.py", line 69, in <module>
sagetex.plot(_sage_const_3 , plt.printfig('test.png'), format='notprovided', epsmagick=False)
AttributeError: 'module' object has no attribute 'printfig'

**** Running Sage on sagetextest.sage failed! Fix sagetextest.tex and try again.