33F3Sz

Written on June 24, 2019
% Dans le préambule
% -----------------
\usepackage{pythontex}
\usepackage{graphicx}
\newcommand{\fig}[2][]{
\IfFileExists{#2}
  {\includegraphics[#1]{#2}}
  {#2 n'existe pas} }
% -----------------


\begin{pyconsole}
from matplotlib.pyplot import *
from numpy import *
X = linspace(-pi, pi, 100)
plot(X, sin(X))
savefig("graphe01.png")
\end{pyconsole}

\begin{figure}[h]
  \centering
  \fig[scale=0.5]{graphe01.png}
  \caption{graphe01.png}
\end{figure}