iPython Magic for Easy Dark/Light Figures

matplotlib, dark, figures
pip install easydarkfigs==0.11


easydarkfigs - iPython Magic for easy Dark/Light Matplotlib figures


easydarkfigs can be installed through pip via

pip install easydarkfigs

Important Installation Note

easydarkfigs comes packaged with two custom matplotlib style files. The first time you import easydarkfigs, it will copy those files over to your local matplotlib style library, but you must then restart your notebook kernel or matplotlib will not recognize they are there. This is only a one-time issue.

If anyone knows a good way of solving this issue (such that the files are copied over on pip install) please see the Issues list to this Repo.


Within an active iPython or Jupyter environment:

import easydarkfigs

Then, at the beginning of a cell where a Matplotlib figure is created:

%%savefig_dark_light figname.ext
# Code
# to
# create
# figure

This will save two versions of the created figure, using the easy-dark and easy-light Matplotlib style files included with this package.

To customize these default styles, edit them in your matplotlib directory.

To change the default figure save location or styles to use:

%set_darkstyle new-style

%set_darkfigdir my/dir/

%set_lightstyle new-style

%set_lightfigdir my/dir/

The code also makes a boolean variable is_dark available during execution, the value of which changes depending on which version of the plot is being created.

%%savefig_dark_light figname.ext
if is_dark:
    title = 'This Is A Dark Plot'
    title = 'This Is A Light Plot'