Jupyter/Base16mpl
From charlesreid1
Repo: https://github.com/benjaminaschultz/base16-ipython-matplotlibrc
Contents
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.
Creating Config at Default Location
By default, Jupyter will create configurations at ~/.jupyter/
. The first command ensures a configuration directory is created, the second starts a notebook using that configuration.
jupyter notebook --generate-config jupyter notebook
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
Also see Jupyter/Extensions
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
The Jupyter configuration directory already has the dark bespin CSS file in ~/.jupyter/custom/custom.css
, so now we load the dark bespin matplotlib theme to match: