Sunday, April 24, 2016

jupyter notebook

To have vectorial images
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('png', 'pdf')

source: http://blog.rtwilson.com/how-to-get-nice-vector-graphics-in-your-exported-pdf-ipython-notebooks/


To disable access tokens edit (create with jupyter-notebook --generate-config)
 .jupyter/jupyter_notebook_config.py

to contain

c.NotebookApp.token = ''
c.NotebookApp.password = ''
c.NotebookApp.disable_check_xsrf = True
 
and optionally
c.NotebookApp.open_browser =False

to have white bg for figs


 ipython profile locate
in the specified folder (~/.ipython/profile_default)  create 

~/.ipython/profile_default/ipython_kernel_config.py
reading
c.InlineBackend.rc = {"figure.facecolor": (1, 1, 1, 1),
                      "axes.facecolor": (1, 1, 1, 1)}


to have inline images

%matplotlib inline
import matplotlib
matplotlib.rcParams["figure.facecolor"]=(1,1,1,1)
matplotlib.rcParams["axes.facecolor"]=(1,1,1,1)

No comments:

Post a Comment