C
chitturk
\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{wrapfig} % Allows in-line images
\usepackage{pythontex}
\setpythontexworkingdir{.}
\begin{document}
This is an example of using pythontex
\begin{pycode}
import pylab as p
import numpy as np
x = np.linspace(0.0,1.0,10)
y = 2.0*x + 5.0
xmax = max(x)
ymax = max(y)
p.plot(x,y)
outputfile = 'myplot.png'
p.savefig(outputfile)
p.clf()
\end{pycode}
% this works fine, I can print the name of the output file, variables
The plot is named \py{outputfile}, the max in x was \py{xmax} and \py{ymax}
% now I would like to plot it, this works
\includegraphics[scale=0.75]{myplot.png}
% but when I do this
%\includegraphics[scale=0.75]{\py{outputfile}}
% I get
%! File ended while scanning definition of \filename@base.
%<inserted text>
% }
% no pdf
\end{document}
\usepackage{graphicx}
\usepackage{wrapfig} % Allows in-line images
\usepackage{pythontex}
\setpythontexworkingdir{.}
\begin{document}
This is an example of using pythontex
\begin{pycode}
import pylab as p
import numpy as np
x = np.linspace(0.0,1.0,10)
y = 2.0*x + 5.0
xmax = max(x)
ymax = max(y)
p.plot(x,y)
outputfile = 'myplot.png'
p.savefig(outputfile)
p.clf()
\end{pycode}
% this works fine, I can print the name of the output file, variables
The plot is named \py{outputfile}, the max in x was \py{xmax} and \py{ymax}
% now I would like to plot it, this works
\includegraphics[scale=0.75]{myplot.png}
% but when I do this
%\includegraphics[scale=0.75]{\py{outputfile}}
% I get
%! File ended while scanning definition of \filename@base.
%<inserted text>
% }
% no pdf
\end{document}