From charlesreid1

Line 35: Line 35:
==Loading Extension==
==Loading Extension==


To load this extension in the notebook, do one of the following two things:
This is very hacky and will not work for long... but haven't figured out Jupyter extensions yet.


(a) Copy the dir <code>base16-ipython-mplrc/base16-mplrc-themes</code> and the file <code>base16-ipython-mplrc/base16_mplrc.py</code> to a path in the data directory, e.g., <code>~/Library/Jupyter/</code>. Once in the notebook, executing the notebook magic <code>%load_ext base16_mplrc</code>
Copy the dir <code>base16-ipython-mplrc/base16-mplrc-themes</code> and the file <code>base16-ipython-mplrc/base16_mplrc.py</code> to <code>~/.ipython/extensions</code>


(b) Modify the config file to automatically load the extension<code>$JUPYTER_CONFIG_DIR/jupyter_notebook_config.py</code> to include the following:
This should create the necessary extension and magic at the ipython level, which is then passed up to the notebook. (However, this method will soon be deprecated - in favor of what??)
 
Now load the extension:
 
<pre>
%load_ext base16_mplrc
</pre>
 
Now you can set the color scheme you want base16_mplrc to use:


<pre>
<pre>
c.InteractiveShellApp.extensions = [ 'base16_mplrc' ]
%base16_mplrc dark bespin
</pre>
</pre>


(method a not working, method b untested)
This loads the dark bespin theme:
 
[[Image:JupyterBase16_after_after.png|500px]]

Revision as of 13:14, 2 December 2017

Repo: https://github.com/benjaminaschultz/base16-ipython-matplotlibrc

Instructions

The instructions from the repo say to copy the base16_mplrc directory into the ipython extensions directory. However, these instructions are several years out of date and don't work out of the box with Jupyter.

Directories in Jupyter

Start by finding the data directories where Jupyter is searching for extensions.

Run jupyter with the --paths flag:

jupyter --paths

This will list all of the config and data paths that Jupyter is using.

Custom Config and Data Paths

As mentioned on the Jupyter/Base16 page and the Jupyter/Profiles page, a new config path can be added by setting $JUPYTER_CONFIG_DIR before generating a config directory or running a notebook server:

JUPYTER_CONFIG_DIR=~/jupyter_custom jupyter notebook --generate-config
JUPYTER_CONFIG_DIR=~/jupyter_custom jupyter notebook

Likewise, to set a path for Jupyter to load extensions from, set the $JUPYTER_PATH variable:

JUPYTER_PATH=~/jupyter_data jupyter notebook

Loading Extension

This is very hacky and will not work for long... but haven't figured out Jupyter extensions yet.

Copy the dir base16-ipython-mplrc/base16-mplrc-themes and the file base16-ipython-mplrc/base16_mplrc.py to ~/.ipython/extensions

This should create the necessary extension and magic at the ipython level, which is then passed up to the notebook. (However, this method will soon be deprecated - in favor of what??)

Now load the extension:

%load_ext base16_mplrc

Now you can set the color scheme you want base16_mplrc to use:

%base16_mplrc dark bespin

This loads the dark bespin theme:

JupyterBase16 after after.png