all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Florian Lindner <mailinglists@xgm.de>
To: emacs-orgmode@gnu.org
Subject: Problem with python session
Date: Thu, 6 Oct 2016 14:41:02 +0200	[thread overview]
Message-ID: <nt5gos$14m$1@blaine.gmane.org> (raw)

Hello,

I have an org file:

* Overview of available basis functions
#+BEGIN_SRC python :session generateBFpics :exports results :results file
  import matplotlib.pyplot as plt
  import numpy as np

  def set_plotoptions():
      plt.xlabel("x")
      plt.ylabel("$\phi(x)$")
      plt.grid()


  np.seterr(invalid='ignore')

  x = np.linspace(-3, 3, 1000)

  plt.plot(x,  np.log(abs(x))*np.power(x, 2))
  plt.suptitle("Thin Plate Splines")
  plt.title("$\phi(|x|) = \log(x) \cdot x^2$")
  set_plotoptions()
  plt.savefig("bf-tps.pdf")
  plt.close()
  "bf-tps.pdf"
#+END_SRC

#+RESULTS:
[[file:bf-tps.pdf]]

#+BEGIN_SRC python :session generateBFpics :exports results :results file
  for shape in [1, 2, 3, 4]:
      plt.plot(x, np.power(shape, 2) + np.power(x,2), label = "s = %i" % shape)
  plt.suptitle("Multi Quadrics")
  plt.title("$\phi(|x|) = s^2 + x^2$")
  plt.legend()
  set_plotoptions()
  plt.savefig("bf-multiquadrics.pdf")
  plt.close()
  "bf-multiquadrics.pdf"
#+END_SRC

#+RESULTS:
[[file:bf-multiquadrics.pdf]]



Both PDFs are generated. But only the first one has the content I expect, the othe one is an empty plot (it's a plot,
yes, but empty axes.

When I copy these pieces of code into on .py file it works just great. To my understanding that just how session mode works.

What could be the problem here?

Thanks,
Florian

             reply	other threads:[~2016-10-06 12:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-06 12:41 Florian Lindner [this message]
2016-10-06 17:54 ` Problem with python session William Henney
2016-10-09  9:30   ` Nicolas Goaziou
2016-10-10 18:40     ` John Kitchin
2016-10-11 15:53       ` Nicolas Goaziou
2016-10-13  4:10         ` William Henney

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

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

  git send-email \
    --in-reply-to='nt5gos$14m$1@blaine.gmane.org' \
    --to=mailinglists@xgm.de \
    --cc=emacs-orgmode@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.