[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] export image generated by python code.
From: |
Darlan Cavalcante Moreira |
Subject: |
Re: [O] export image generated by python code. |
Date: |
Mon, 30 Apr 2012 12:14:12 -0300 |
User-agent: |
Wanderlust/2.15.9 (Almost Unreal) Emacs/24.1 Mule/6.0 (HANACHIRUSATO) |
Remember that when you execute the code via "C-c C-c" it is run in a
temporary file which is not in the same folder as the org file from where
it was generated from. Maybe you are reading some data from a file and
Python is not able to locate the file when run with "C-c C-c".
Put ":results output" in the header and then print the current working
directory to see what I mean. If this is the problem, use the full path to
load any data you need in the python code. Remember you can use variables
in org-babel to pass this path to python, such as ":var
datapath="some_path_or_lisp_function_to_get_the_path" in the babel header..
--
Darlan
At Mon, 30 Apr 2012 15:54:34 +0200,
Khoroshyy Petro <address@hidden> wrote:
>
> Hi all.
> After some struggle, I can see inline pictures in my org file.
> The problem was python execution. If I execure the code in python-mode
> shell, it generates a picture.
> I the code executed via C-c C-c, the output picture file is empty.
> I still do not know how to solve it.
>
> And I have encountered another problem. The 'result' image is not
> exported, even if I add play with :export option.
>
> Any recommendations how to solve those?
> Thanks
> Petro
> #+BEGIN_SRC python :file estimated_spectra_cl.png
> import pylab
> from scipy import optimize
> import numpy as np
> import pylab as plt
> .....
> plt.figure()
> plt.plot(spectra[:,0],spectra[:,1:])
> plt.grid(1)
> # plt.show()
> plt.savefig("estimated_spectra_cl.png",dpi=100)
> #+END_SRC
>
> #+RESULTS:
> [[file:estimated_spectra_cl.png]]
>