[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] Matplotlib (Python) plots inline
From: |
Torsten Bronger |
Subject: |
[O] Matplotlib (Python) plots inline |
Date: |
Mon, 06 Jun 2011 11:21:22 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
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: address@hidden
or http://bronger-jmp.appspot.com
- [O] Matplotlib (Python) plots inline,
Torsten Bronger <=