Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #54598

python, pythontex and plots

X-Received by 10.224.112.133 with SMTP id w5mr8571559qap.5.1379881567438; Sun, 22 Sep 2013 13:26:07 -0700 (PDT)
X-Received by 10.49.72.65 with SMTP id b1mr1383qev.21.1379881567369; Sun, 22 Sep 2013 13:26:07 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!d5no1527284qap.0!news-out.google.com!gv3ni1143qab.0!nntp.google.com!d5no1527279qap.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Sun, 22 Sep 2013 13:26:06 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=71.207.177.152; posting-account=eDmu7QoAAADv0Pu-8YzAIWuwKniuf8Tq
NNTP-Posting-Host 71.207.177.152
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <6ce735c9-dfd4-45df-8423-8eb909d4de34@googlegroups.com> (permalink)
Subject python, pythontex and plots
From chitturk@uah.edu
Injection-Date Sun, 22 Sep 2013 20:26:07 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.python:54598

Show key headers only | View raw


\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 | NextNext in thread | Find similar | Unroll thread


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