From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Stanton Subject: Re: Plotting in Python block won't over-write existing file Date: Sun, 8 Mar 2015 21:17:28 -0700 Message-ID: References: Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YUp8M-0000Fw-MK for emacs-orgmode@gnu.org; Mon, 09 Mar 2015 00:17:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YUp8J-00021i-Vs for emacs-orgmode@gnu.org; Mon, 09 Mar 2015 00:17:38 -0400 Received: from mail-pd0-f182.google.com ([209.85.192.182]:43876) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YUp8J-00021c-QR for emacs-orgmode@gnu.org; Mon, 09 Mar 2015 00:17:35 -0400 Received: by pdjp10 with SMTP id p10so54732280pdj.10 for ; Sun, 08 Mar 2015 21:17:33 -0700 (PDT) Received: from [10.0.0.13] (c-50-136-135-172.hsd1.ca.comcast.net. [50.136.135.172]) by mx.google.com with ESMTPSA id hz8sm16708933pac.5.2015.03.08.21.17.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 08 Mar 2015 21:17:30 -0700 (PDT) In-Reply-To: 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: emacs-orgmode@gnu.org > Date: Fri, 06 Mar 2015 14:21:54 -0500 > From: Nick Dokos > To: emacs-orgmode@gnu.org > Subject: Re: [O] Plotting in Python block won't over-write existing > file > Message-ID: <87sidi9bjh.fsf@alphaville.usersys.redhat.com> > Content-Type: text/plain; charset=3Dutf-8 >=20 > Richard Stanton writes: >=20 >> Here?s a sample Python code block: >>=20 >> #+begin_src python :results file :exports both >> import matplotlib >> matplotlib.use('Agg') >> import matplotlib.pyplot as plt >> import pandas as pd >>=20 >> df =3D pd.DataFrame({'date': [1900, 1901, 1902], 'x1' : [3, 4, 5], = 'x2' : [6, 7, 9]}) >> df.set_index('date', inplace=3DTrue, drop=3DTrue) >> df.plot() >> plt.savefig('x4.png') >> return 'x4.png' # return filename to org-mode >> #+End_src >>=20 >> When I run it, the graph appears on the screen and in the named file, = as desired. >>=20 >> However, if I go back, change one of the numbers, and rerun the = block, >> while it claims to have run OK, the graph is not updated. I only get = a >> new plot if I also change the file name (e.g., to x5.png). It looks >> like it?s refusing to over-write an existing file. Is there a reason >> for this, and is there a way to change this behavior? >>=20 >> By the way, this is with org-mode 8.3beta-884-g9ed426 >>=20 >=20 > IIUC, you eval the code, hit the resulting link (which opens a buffer = with the > graph), change a number and reeval the code - do you hit the link = again? > That should ask you whether you want to read the changed file again = and > show the updated graph. Thanks, Nick. After MUCH investigation, and a lot of help from John = Kitchen, I worked out that a. The file was changing fine on disk, just not redisplaying in Emacs. b. The problem seems to be related to the version of Emacs I'm using = (24.4 for OS X), downloaded from http://emacsformacosx.com/builds. After = going back there and downloading and installing Emacs 24.4.90 pretest, = org-mode now updates graphs just fine.=20 I don't know what the problem was, or why changing the Emacs version = solved it (with no other changes), but maybe this will be helpful to = someone else. Best, RIchard Stanton=