Re: [O] org-babel generated images and +ATTR_LATEX

2013-10-24 Thread Michael Gauland
Mark Edgington edgimar at gmail.com writes:
 Anyhow, something that wasn't clear to me about your example is how you make
 the filename which is generated via org-babel-temp-file available for use
 within the code-block?

Babel takes care of that (plantuml interprets the :file argument as the name
of the file it should generate). I'm not sure the best way to get the file
name in to a Python block. You could probably pass the generated name in as
a :var parmater.





Re: [O] org-babel generated images and +ATTR_LATEX

2013-10-23 Thread Michael Gauland
Mark,
I think you want to use named results. My images typically look something
like this:

   #+NAME: architecture
   #+HEADER: :exports results
   #+HEADER: :file (org-babel-temp-file ./figure- .eps)
   #+HEADER: :cache yes
   #+BEGIN_SRC plantuml
   ...
   #+END_SRC

   #+NAME: fig-architecture
   #+CAPTION: Overview of mini-me architecture.
   #+ATTR_LaTeX: :width \textwidth :placement [h!bt]
   #+RESULTS: architecture
  
[[file:c:/Users/mgauland/AppData/Local/Temp/babel-5988Tli/figure-5988XRB.eps]]

Does that help?

Kind Regards,
Mike





Re: [O] org-babel generated images and +ATTR_LATEX

2013-10-23 Thread Mark Edgington
Hi Mike,

That does help -- when testing it, I found that the problem had more to do
with my header options than to do with the presence or absence of a #+NAME
line.  But still, with the header options I gave in my original example,
org-babel's behavior does seem strange (maybe buggy?) to me.  My working
code now looks like:

#+begin_src python :exports results :results file :eval no-export
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
fig=plt.figure(figsize=(3,2))
plt.plot([1,3,2])
fig.tight_layout()
figname = '/tmp/myfig.jpg'
plt.savefig(figname)
return(figname) # return this to org-mode
#+end_src

#+ATTR_LATEX: :float figure :placement [htb!] :width 0.38\textwidth 
#+RESULTS:

Anyhow, something that wasn't clear to me about your example is how you make
the filename which is generated via org-babel-temp-file available for use
within the code-block?

Regards,

Mark