Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #54610
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2013-09-22 19:16 -0700 |
| References | <6ce735c9-dfd4-45df-8423-8eb909d4de34@googlegroups.com> <523f9252$0$29988$c3e8da3$5496439d@news.astraweb.com> |
| Message-ID | <ffb00909-ed74-4330-a448-dd778b346b3b@googlegroups.com> (permalink) |
| Subject | Re: python, pythontex and plots |
| From | chitturk@uah.edu |
1) The file is LaTeX
2) the % means LaTeX will ignore it.
3) The question was about using pythontex with LaTeX
4) I included the file so you (OK, others) could see what I was trying
5) The problem had to do with accessing a file name within the python
script using \py{outputfile}
6) pythontex is a terrific package that I enjoy using
7) I was looking for help on debugging this error.
8) I was trying to find out why I could not do \py{outfilename}
On Sunday, September 22, 2013 7:58:59 PM UTC-5, Steven D'Aprano wrote:
> I don't usually top post, but for this I'll make an exception because I
>
> have *no idea* what any of your post means.
>
>
>
> Are you actually asking a question? I can't see a question mark in it, so
>
> there's no explicit question. Are you just sharing something interesting
>
> you have learned? Expecting us to read your mind and intuit what the
>
> question is?
>
>
>
> Why do nearly, but not quite all, the lines in your post start with % or
>
> \ or sometimes both? It looks like Postscript rather than Python.
>
>
>
> Perhaps you should try again, and this time don't assume that we're
>
> familiar with whatever it is you're doing. Remember to include natural
>
> language explaining what your problem is, what result you expected, what
>
> result you actually got. In this forum, use English please. This is
>
> *especially* critical if using an unusual technology that most people are
>
> not familiar with.
>
>
>
> I strongly recommend that first you read this:
>
>
>
> http://sscce.org/
>
>
>
> Its written for Java developers, but the same basic principles apply for
>
> Python. Remember that the number one language you should be using for
>
> communication is natural language (English in this forum) and code only
>
> second.
>
>
>
> Thank you.
>
>
>
>
>
> Steve
>
>
>
> On Sun, 22 Sep 2013 13:26:06 -0700, chitturk wrote:
>
>
>
> > \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 — Previous in thread | 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