emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Problem with python session
@ 2016-10-06 12:41 Florian Lindner
  2016-10-06 17:54 ` William Henney
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Lindner @ 2016-10-06 12:41 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-10-13  4:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-06 12:41 Problem with python session Florian Lindner
2016-10-06 17:54 ` 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

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).