4

Certain packages I am using create images that have black text. Unfortunately, my Jupyter theme is dark so this text is hard to read. The packages do not have parameters to change the font color easily. I would rather not change my jupyter theme, but ideally change the background color of a single jupyter cell's output. There was a similar question to change the color of the cells itself (How to change the background color of a single cell in a jupyter notebook / jupyterlab?), but I would like to change the output background color.

As you can see I can't see much due to my jupyter theme. I'm using scanpy and squidpy here.

Arun
  • 41
  • 4

1 Answers1

0

After a discussion on GitHub we narrowed down the same issue but reported by another user due to outdated version of ipykernel. To fix this, upgrade your ipykernel version and make sure it is newer than 4.9:

pip install -U ipykernel
# conda update ipykernel   # if you use conda

If you cannot upgrade for some reason, you could use a workaround of manually changing style:

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

to get a consistent dark background, or use one of:

plt.style.use('seaborn')

or

plt.style.use('ggplot')

to get a consistent dark background. This is because scanpy uses matplotlib to render the figures so you should be able to just tweak matplotlib rendering settings to your liking with matplotlib APIs. For more on matplotlib styles see the documentation here.

krassowski
  • 13,598
  • 4
  • 60
  • 92