Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #54598
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2013-09-22 13:26 -0700 |
| Message-ID | <6ce735c9-dfd4-45df-8423-8eb909d4de34@googlegroups.com> (permalink) |
| Subject | python, pythontex and plots |
| From | chitturk@uah.edu |
\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}
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
python, pythontex and plots chitturk@uah.edu - 2013-09-22 13:26 -0700
Re: python, pythontex and plots Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-23 00:58 +0000
Re: python, pythontex and plots chitturk@uah.edu - 2013-09-22 19:16 -0700
Re: python, pythontex and plots Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-23 03:38 +0000
Re: python, pythontex and plots rusi <rustompmody@gmail.com> - 2013-09-22 21:54 -0700
Re: python, pythontex and plots chitturk@uah.edu - 2013-09-23 07:09 -0700
Re: python, pythontex and plots Piet van Oostrum <piet@vanoostrum.org> - 2013-09-24 14:38 -0400
csiph-web