Giter Site home page Giter Site logo

Comments (5)

non-Jedi avatar non-Jedi commented on May 17, 2024

Probably a dup of #16.

from jupyter.

nnicandro avatar nnicandro commented on May 17, 2024

Is your Org version >= 9.2? The semantics of :file has changed in Org >= 9.2, you also need to specify :results link for it to work. Specifying :file by itself now means to write whatever the source block returns to file.

So it should be

#+BEGIN_SRC jupyter-python :session py :file ./test.png :results link
import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
#+END_SRC

However if you specify :async yes everything should work without :results link. You may also need to add %matplotlib inline before the plot call, see https://ipython.readthedocs.io/en/stable/interactive/plotting.html#id1.

Also note, there is an issue about consistent use and meaning of header arguments #40.

from jupyter.

AoifeHughes avatar AoifeHughes commented on May 17, 2024

I'm using org 9.1.9 - Updating to use async works. Thanks!

Any idea why the async is required?

from jupyter.

nnicandro avatar nnicandro commented on May 17, 2024

For :async yes we have a custom result insertion method that doesn't go through org-mode (the :async no case does) and therefore doesn't follow the semantics of org-modes header arguments in the same way. The main reason this is done is so that when :async yes is specified, results are inserted in the buffer as they come in, much like a Jupyter notebook. In the :async no case, the results are collected first and then inserted (through org-modes result insertion) after the code block finishes.

I opened #40 to address the consistency of how header arguments are handled in the :async yes vs :async no case.

from jupyter.

nnicandro avatar nnicandro commented on May 17, 2024

Closing this as #40 is more relevant.

from jupyter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.