Reputation: 61
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.
Upvotes: 6
Views: 17584
Reputation: 133
I found one solution for expanding the plot canvas a bit so that x and y ticks will get visible.
You need to add one line plt.style.use('default')
after importing the matplot lib module in notebook.
See my ticks are outside the canvas before.
After adding the line the tick got added to the canvas itself no further modification was needed.
As you can see in the above image this will pull the x and y ticks in the canvas to make it visible without changing or modifying ticks or plot color, it will make it easier to collaborate your work with others.
Upvotes: 6
Reputation: 31
If your Jupyter Notebook is installed using Anaconda . You need to install Jupyterthemes in you conda environment:
conda install -c conda-forge jupyterthemes
Upvotes: 1
Reputation: 31
I got the same problem, I resolved changing the character (’) by (') in (https://medium.com/@rbmsingh/making-jupyter-dark-mode-great-5adaedd814db), and now it's working, below it's the text corrected, good luck !
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from jupyterthemes import jtplot
jtplot.style(theme='monokai', context='notebook', ticks=True, grid=False)
Upvotes: 3
Reputation: 181
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
Upvotes: 18