From mboxrd@z Thu Jan 1 00:00:00 1970 From: Torsten Bronger Subject: Matplotlib (Python) plots inline Date: Mon, 06 Jun 2011 11:21:22 +0200 Message-ID: <87fwnn71t9.fsf@physik.rwth-aachen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:43270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTW3Z-0006Ch-9B for emacs-orgmode@gnu.org; Mon, 06 Jun 2011 05:25:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QTW3W-0001nj-RK for emacs-orgmode@gnu.org; Mon, 06 Jun 2011 05:25:09 -0400 Received: from lo.gmane.org ([80.91.229.12]:51198) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTW3W-0001mr-DT for emacs-orgmode@gnu.org; Mon, 06 Jun 2011 05:25:06 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QTW3U-0005dU-5p for emacs-orgmode@gnu.org; Mon, 06 Jun 2011 11:25:04 +0200 Received: from koln-5d81177b.pool.mediaways.net ([93.129.23.123]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 06 Jun 2011 11:25:04 +0200 Received: from bronger by koln-5d81177b.pool.mediaways.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 06 Jun 2011 11:25:04 +0200 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 Hallöchen! I wonder what is the best way to include plots generated from Python code into my notes. I found a way but maybe there's a better one. What I do is --8<---------------cut here---------------start------------->8--- #+begin_src python import numpy, matplotlib, matplotlib.pyplot figure = matplotlib.pyplot.figure() axes = figure.add_subplot(111, title=u"Hello", xlabel="x", ylabel="y") x = numpy.arange(-10, 10, 0.1) axes.plot(x, x**2) figure.savefig("/tmp/plot_test.png") figure.clf() #+end_src #+results: : None [[/tmp/plot_test.png]] --8<---------------cut here---------------end--------------->8--- However, it is a little bit cumbersome. Is there an easier way to define code (possibly with boilerplate), and let it be replaced with the graphics file it produces? Tschö, Torsten. -- Torsten Bronger Jabber ID: torsten.bronger@jabber.rwth-aachen.de or http://bronger-jmp.appspot.com