emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jack Kamm <jackkamm@gmail.com>
To: Jeremie Juste <jeremiejuste@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: save plot in python babel
Date: Tue, 25 Aug 2020 06:50:02 -0700	[thread overview]
Message-ID: <87y2m2g7hx.fsf@gmail.com> (raw)
In-Reply-To: <87imd7ue06.fsf@gmail.com>

Hi Jeremie,

> I tried to look around and noticed that the documentation regarding
> python with org-mode is aging a bit...  Any help will be
> appreciated. I'll be ready to improve the documentation of org-babel
> python setup as soon as I'm more familiar with it myself.

Historically ob-python has been a bit broken, especially
sessions. Earlier this year, I started taking care of ob-python and
implemented some fixes [1], which will land in 9.4. When that's
released, I plan to update the outdated worg documentation [2].

> I've barely use python with org-mode and I would need some help with
> the python setup. I somehow have some trouble saving python plots. Is
> this the right way to do it?

This part of the documentation [2], at the bottom of the page, is still
up-to-date. Basically, you need to manually call plt.savefig(), then
return the filename.

> In R things seems to be smoother.

Yes, ob-R is in much better shape. In addition to plotting, returning
dataframes works (pandas DataFrames are not yet supported in
ob-python). I also much prefer the way ob-R returns lists as a column
vector instead of a row vector.

> there are ob-* all over the place. [1] ob-ipython does not seem to be
> maintained

For serious work these days, I'm using ob-jupyter [3], which works
really well. Scimax [4] also has a maintained fork of ob-ipython, though
I haven't tried it.

My goal is to make ob-python a serious alternative to these external
ob-* packages eventually. Here are some of the improvements I have in
mind:

- Improved plotting
- Support for pandas DataFrames and numpy Arrays
- Async session evaluation [5]

I've been delayed working on this as I've gotten very busy due to the
pandemic (I am a bioinformaticist working on SARS-CoV-2 sequencing). But
I'm hoping to make a bit of progress this week, as I'm on vacation and
unable to go outside due to the smoke from the California fires.

It's unclear to me if we're in a feature freeze, so I'm currently
pushing ob-python development to a separate branch [6], which I'll
cherry pick into master after the Org 9.4 release.

[1] https://orgmode.org/list/87pnfdo88v.fsf@gmail.com/
[2] https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html
[3] https://github.com/nnicandro/emacs-jupyter
[4] https://github.com/jkitchin/scimax
[5] https://github.com/jackkamm/ob-session-async
[6] https://code.orgmode.org/jackkamm/org-mode/src/python-develop


  reply	other threads:[~2020-08-25 13:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-25 12:05 save plot in python babel Jeremie Juste
2020-08-25 13:50 ` Jack Kamm [this message]
2020-08-26 21:02   ` Jeremie Juste

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y2m2g7hx.fsf@gmail.com \
    --to=jackkamm@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jeremiejuste@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).