From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Plotting in Python block won't over-write existing file Date: Fri, 06 Mar 2015 14:21:54 -0500 Message-ID: <87sidi9bjh.fsf@alphaville.usersys.redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTxrw-0003S4-H5 for emacs-orgmode@gnu.org; Fri, 06 Mar 2015 14:25:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YTxrt-0003kT-6i for emacs-orgmode@gnu.org; Fri, 06 Mar 2015 14:25:08 -0500 Received: from plane.gmane.org ([80.91.229.3]:54543) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTxrt-0003gv-11 for emacs-orgmode@gnu.org; Fri, 06 Mar 2015 14:25:05 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YTxrq-0007iM-KJ for emacs-orgmode@gnu.org; Fri, 06 Mar 2015 20:25:02 +0100 Received: from pool-173-76-32-186.bstnma.fios.verizon.net ([173.76.32.186]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 06 Mar 2015 20:25:02 +0100 Received: from ndokos by pool-173-76-32-186.bstnma.fios.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 06 Mar 2015 20:25:02 +0100 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 Richard Stanton writes: > Here’s a sample Python code block: > > #+begin_src python :results file :exports both > import matplotlib > matplotlib.use('Agg') > import matplotlib.pyplot as plt > import pandas as pd > > df = pd.DataFrame({'date': [1900, 1901, 1902], 'x1' : [3, 4, 5], 'x2' : [6, 7, 9]}) > df.set_index('date', inplace=True, drop=True) > df.plot() > plt.savefig('x4.png') > return 'x4.png' # return filename to org-mode > #+End_src > > When I run it, the graph appears on the screen and in the named file, as desired. > > 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? > > By the way, this is with org-mode 8.3beta-884-g9ed426 > 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. Nick