python - Force Jupyter Notebook not to store cached rendered figures into *.ipynb -
typically, use jupyter notebook make documentation of numerical math in projects on github. consider writing python code generates figures on-the-fly economical way how store figures. git can version-control python code more efficiently binary data of rendered figures.
# initialize environment %matplotlib inline import numpy np import matplotlib.pyplot plt import sympy sy x = np.linspace(0.0,10.0,1000) dx = x[1]-x[0] # markdown doc # plot figures = (1.0-x**2) b = (x-2)**2 plt.plot(x,a,label='a') plt.plot(x,b,label='b') plt.plot(x,a*b,lw=2,c='k',label='c') vmax=1.00; plt.ylim(-vmax,vmax); plt.xlim(0.0,4.0); plt.grid(); plt.legend() now realized *.ipynb files pushed github contains huge strings encoding rendered figures images this:
"data": { "image/png": "ivborw0kggoaaaansuheugaaaiuaaafkcayaaad....
i force jupyter not that.
edit:
as mentioned in comments underneath there 2 ways:
- in web gui got
cell > output > clear, save - or use simple python script same
but problem neither of method automatic, easy forgot , commit git notebook including images. helpfull have option save striped version of notebook automatically.
Comments
Post a Comment