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 <bron...@physik.rwth-aachen.de> writes: > 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 > > #+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]] > > 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. -- Eric Schulte http://cs.unm.edu/~eschulte/