Jupyter/Base16mpl: Difference between revisions
From charlesreid1
(Created page with "Repo: https://github.com/benjaminaschultz/base16-ipython-matplotlibrc instructions say to copy the base16_mplrc directory into the ipython extensions directory.") |
No edit summary |
||
| Line 1: | Line 1: | ||
Repo: https://github.com/benjaminaschultz/base16-ipython-matplotlibrc | Repo: https://github.com/benjaminaschultz/base16-ipython-matplotlibrc | ||
instructions say to copy the base16_mplrc directory into the ipython extensions directory. | ==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. | |||
* Jupyter paths: https://jupyter.readthedocs.io/en/latest/projects/jupyter-directories.html | |||
Run jupyter with the --paths flag: | |||
<pre> | |||
jupyter --paths | |||
</pre> | |||
This will list all of the config and data paths that Jupyter is using. | |||
As mentioned on the [[Jupyter/Base16]] page and the [[Jupyter/Profiles]] page, a new config path can be added by setting <code>$JUPYTER_CONFIG_DIR</code> before generating a config directory or running a notebook server: | |||
<pre> | |||
JUPYTER_CONFIG_DIR=~/jupyter_custom jupyter notebook --generate-config | |||
JUPYTER_CONFIG_DIR=~/jupyter_custom jupyter notebook | |||
</pre> | |||
Likewise, to set a path for Jupyter to load extensions from, set the <code>$JUPYTER_PATH</code> variable: | |||
<pre> | |||
JUPYTER_PATH=~/jupyter_data jupyter notebook | |||
</pre> | |||
==Loading Extension== | |||
To load this extension in the notebook, do one of the following two things: | |||
(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> | |||
(b) Modify the config file to automatically load the extension<code>$JUPYTER_CONFIG_DIR/jupyter_notebook_config.py</code> to include the following: | |||
<pre> | |||
c.InteractiveShellApp.extensions = [ 'base16_mplrc' ] | |||
</pre> | |||
(method a not working, method b untested) | |||
Revision as of 12:09, 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.
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
To load this extension in the notebook, do one of the following two things:
(a) Copy the dir base16-ipython-mplrc/base16-mplrc-themes and the file base16-ipython-mplrc/base16_mplrc.py to a path in the data directory, e.g., ~/Library/Jupyter/. Once in the notebook, executing the notebook magic %load_ext base16_mplrc
(b) Modify the config file to automatically load the extension$JUPYTER_CONFIG_DIR/jupyter_notebook_config.py to include the following:
c.InteractiveShellApp.extensions = [ 'base16_mplrc' ]
(method a not working, method b untested)