From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dror Atariah Subject: Re: [Orgmode] Unable to capture the file name generated using matplotlib Date: Tue, 5 May 2015 22:20:40 +0200 Message-ID: References: <87wq0qsy4o.fsf@alphaville.usersys.redhat.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b5d986b8b0a1405155b6977 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50432) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpjKh-0001zo-Er for emacs-orgmode@gnu.org; Tue, 05 May 2015 16:20:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YpjKc-0003yD-EJ for emacs-orgmode@gnu.org; Tue, 05 May 2015 16:20:47 -0400 Received: from mail-wi0-x22b.google.com ([2a00:1450:400c:c05::22b]:36419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpjKc-0003wt-3M for emacs-orgmode@gnu.org; Tue, 05 May 2015 16:20:42 -0400 Received: by wizk4 with SMTP id k4so176528735wiz.1 for ; Tue, 05 May 2015 13:20:40 -0700 (PDT) In-Reply-To: <87wq0qsy4o.fsf@alphaville.usersys.redhat.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nick Dokos Cc: "emacs-orgmode@gnu.org" --047d7b5d986b8b0a1405155b6977 Content-Type: text/plain; charset=UTF-8 Obviously, I have the directory in place, and the file is actually saved properly in it. The version is use is: Org-mode version 8.2.10 (8.2.10-40-gc763fa-elpaplus @ /Users/drorata/.emacs.d/elpa/org-plus-contrib-20150504/) Finally, here is the output that I have in the python interactive session: -----------8<-----------8<-----------8<-----------8<-----------8<-----------8<-----------8<-----------8<-----------8<-----------8<-----------8<-----------8<----------- >>> import matplotlib import matplotlib >>> matplotlib.use('Agg') matplotlib.use('Agg') import matplotlib.pyplot as plt >>> import matplotlib.pyplot as plt fig=plt.figure(figsize=(3,2)) >>> fig=plt.figure(figsize=(3,2)) plt.plot([1,3,2]) >>> plt.plot([1,3,2]) fig.tight_layout() fig.tight_layout() plt.savefig('images/myfig.png') plt.savefig('images/myfig.png') 'images/myfig.png' # return this to org-mode 'images/myfig.png' # return this to org-mode open('/var/folders/kz/1c2cxn1x60n_t5p2j1p02b180000gn/T/babel-22151hFS/python-22151B4O', 'w').write(str(_)) open('/var/folders/kz/1c2cxn1x60n_t5p2j1p02b180000gn/T/babel-22151hFS/python-22151B4O', 'w').write(str(_)) 'org_babel_python_eoe' 'org_babel_python_eoe' [] >>> 'images/myfig.png' >>> >>> 16 >>> >>> >>> 'org_babel_python_eoe' >>> -----------8<-----------8<-----------8<-----------8<-----------8<-----------8<-----------8<-----------8<-----------8<-----------8<-----------8<-----------8<----------- >From this it seems like the right thing happens, but still org doesn't manage to capture it. I'm still in the dark. At work I manage to get the images inserted properly and it is simply fabulous! I want it also on my mac!!! :) Thanks in advance, Dror On Sat, May 2, 2015 at 7:11 PM, Nick Dokos wrote: > Dror Atariah writes: > > > How can I solve this problem? > > I should have added: ... after I create the "images" directory. > I don't think the savefig() can do that. > > > --047d7b5d986b8b0a1405155b6977 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Obviously, I have the directory in place, and the file is = actually saved properly in it. The version is use is:
Org-mode version = 8.2.10 (8.2.10-40-gc763fa-elpaplus @ /Users/drorata/.emacs.d/elpa/org-plus-= contrib-20150504/)

Finally, here is the output= that I have in the python interactive session:

--= ---------8<-----------8<-----------8<-----------8<-----------8&= lt;-----------8<-----------8<-----------8<-----------8<--------= ---8<-----------8<-----------8<-----------
>= >> import matplotlib
import matplotlib
>>&g= t; matplotlib.use('Agg')
matplotlib.use('Agg')
import matplotlib.pyplot as plt
>>> import matpl= otlib.pyplot as plt
fig=3Dplt.figure(figsize=3D(3,2))
&= gt;>> fig=3Dplt.figure(figsize=3D(3,2))
plt.plot([1,3,2])
>>> plt.plot([1,3,2])
fig.tight_layout()
<= div>fig.tight_layout()
plt.savefig('images/myfig.png')
plt.savefig('images/myfig.png')
'images/myfig= .png' # return this to org-mode
'images/myfig.png' # = return this to org-mode


open('/= var/folders/kz/1c2cxn1x60n_t5p2j1p02b180000gn/T/babel-22151hFS/python-22151= B4O', 'w').write(str(_))
open('/var/folders/kz/1c= 2cxn1x60n_t5p2j1p02b180000gn/T/babel-22151hFS/python-22151B4O', 'w&= #39;).write(str(_))



=
'org_babel_python_eoe'
'org_babel_pyth= on_eoe'
[<matplotlib.lines.Line2D object at 0x10ebb6eb8>= ;]
>>> 'images/myfig.png'
>>>= >>> 16
>>> >>> >>> 'org_= babel_python_eoe'
>>>=C2=A0
--------= ---8<-----------8<-----------8<-----------8<-----------8<---= --------8<-----------8<-----------8<-----------8<-----------8&l= t;-----------8<-----------8<-----------

From= this it seems like the right thing happens, but still org doesn't mana= ge to capture it. I'm still in the dark. At work I manage to get the im= ages inserted properly and it is simply fabulous! I want it also on my mac!= !! :)

Thanks in advance,
Dror
=


On Sat, May 2, 2015 at 7:11 PM, Nick Dokos <ndokos@gmail.com>= ; wrote:
Dror Ata= riah <drorata@gmail.com> wri= tes:

> How can I solve this problem?

I should have added: ... after I create the "images" direc= tory.
I don't think the savefig() can do that.




--047d7b5d986b8b0a1405155b6977--