Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dark mode plots in Jupyter Notebook - Python

I'm using Jupyter Notebook and I'm currently using the dark solarized theme on it from JupyterThemes.

I notice that my plots are not in dark mode and the text is still black and unreadable on the solarized background. The readme for JupyterThemes suggests creating a startup.ipy in ~/.ipython/profile_default/startup/startup.ipy and writing

# import jtplot submodule from jupyterthemes
from jupyterthemes import jtplot

# currently installed theme will be used to
# set plot style if no arguments provided
jtplot.style()

I have created this file but nothing has changed. I've also tried following this guide (https://medium.com/@rbmsingh/making-jupyter-dark-mode-great-5adaedd814db) but again my plots haven't changed.

Any help? I enjoy using dark mode in Jupyter Notebook and I would like to have legible plots.

like image 533
evicta Avatar asked Aug 23 '26 03:08

evicta


1 Answers

When I work in dark mode I add the style line below after the matplotlib import and all the graphs in the notebook are formated with a black background and white text.

import matplotlib.pyplot as plt  
plt.style.use('dark_background')

Hope this helps

like image 74
Anthony Wynne Avatar answered Aug 25 '26 17:08

Anthony Wynne