# Displaying a matplotlib picture using SageTeX

I couldn't draw the picture I want in a LaTeX document using SageTeX.

Here is my code.

\begin{sagesilent} import numpy as np from scipy.fftpack import fft,ifft N1 = 16 n1 = np.linspace(0.0,16,N1) y = np.array([np.cos(((2.0 * np.pi*i))/N1) for i in range (0,N1)]) yf = fft(y) import matplotlib import matplotlib.pyplot as plt fig = plt.figure(2) ax = fig.add_subplot(221) plt.plot(n1,y) ay = fig.add_subplot(222) p = plt.plot(n1,yf) g = plt.savefig("test.svg", format="svg") plt.close(fig) \end{sagesilent}