^^Python. Jupyter.

 

  1. jupyter.org/about
  2. twitter.com/LorenaABarba
  3. jupyter4edu.github.io/jupyter-edu-book/
  4. jose.theoj.org/papers/10.21105/jose.00015

 

Jupyter notebook is a browser-based editor and graphical interface to the IPython shell; it must connect to a running Python process in order to execute code. This process (known as a "kernel") can be started by running the following command in your system shell:

 
$ jupyter notebook

 

viene avviata una finestra del browser di default, contenente il notebook.

 

Plotting from an IPython notebook

Per inizializzare matplotlib in un notebook jupyter

%matplotlib inline
import matplotlib.pyplot as plt

To create an embedded plot in the notebook, 2 options

Come disegnare

import numpy as np
x = np.linspace(0, 10, 100)
plt.plot(x, np.sin(x), '-')
plt.plot(x, np.cos(x), '--')

Disegnare e salvare (rispettare ordine cmd)

fig = plt.figure()
plt.plot(x, np.sin(x), '-')
plt.plot(x, np.cos(x), '--')
fig.savefig('my_figure.png')

save in the current working directory

Verificare esistenza file con un cmd al SO

! dir my_figure.png

Richiamare a schermo da file

from IPython.display import Image
Image('my_figure.png')