Owlglass

Org Mode - Python/Jupyter Example

Create a Session

Initialize server with org-babel-exp-src-block. Afterwards, ‘Enter’ in the sourceblock will execute.

print('hello, world!')
a = 10

Create a plot

import matplotlib, numpy
matplotlib.use('Agg')
import matplotlib.pyplot as plt
fig=plt.figure(figsize=(4,2))
x=numpy.linspace(-15,15)
plt.plot(numpy.sin(x)/x)
fig.tight_layout()
plt.savefig('python-matplot-fig.png')
return 'python-matplot-fig.png' # return filename to org-mode

Ocaml

print_string "Hello world!\n"