From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Matplotlib (Python) plots inline Date: Mon, 06 Jun 2011 06:14:04 -0600 Message-ID: <87aadvazev.fsf@gmail.com> References: <87fwnn71t9.fsf@physik.rwth-aachen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:49665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTZPK-0005DC-3i for emacs-orgmode@gnu.org; Mon, 06 Jun 2011 08:59:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QTZPI-0001Xw-3j for emacs-orgmode@gnu.org; Mon, 06 Jun 2011 08:59:49 -0400 Received: from mail-gw0-f41.google.com ([74.125.83.41]:57519) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTZPH-0001Xr-Pc for emacs-orgmode@gnu.org; Mon, 06 Jun 2011 08:59:47 -0400 Received: by gwaa12 with SMTP id a12so1831473gwa.0 for ; Mon, 06 Jun 2011 05:59:47 -0700 (PDT) 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 Hi Torsten, You could try #+begin_src python :exports results :file /tmp/plot_test.png ... #+end_src Which should behave as desired. Best -- Eric Torsten Bronger writes: > Hall=C3=B6chen! > > 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 > > #+begin_src python > import numpy, matplotlib, matplotlib.pyplot > figure =3D matplotlib.pyplot.figure() > axes =3D figure.add_subplot(111, title=3Du"Hello", xlabel=3D"x", ylabel= =3D"y") > x =3D 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]] > > 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=C3=B6, > Torsten. --=20 Eric Schulte http://cs.unm.edu/~eschulte/