Liu Hui <liuhui1...@gmail.com> writes:

> Hi,
>
> This patch adds graphics output support for ob-python via matplotlib.
> Specifically, it allows to use header argument `:results file
> graphics' as follows:
>
> #+begin_src python :file "test.png" :results graphics file
> import matplotlib.pyplot as plt
> plt.plot([1,2,3,4,5])
> #+end_src
>
> The feature is described in the documentation as follows and has been
> supported by ob-R, ob-julia, etc.

Thanks -- I haven't had a chance to test drive this yet, but I do have a
couple questions:

1. Do you need to add a call to pyplot.gcf().clear(), in case of
multiple blocks in a session?

2. Would it make sense to wrap in pyplot.rc_context, so that we can use
the :width and :height arguments like ob-R? E.g.,

with pyplot.rc_context({'figure.figsize': (8,5)}):
     pyplot.plot([1,2,3,4,5])
     pyplot.gcf().savefig('filename.png')

Will create a png file with width 8 and height 5.

Reply via email to