【问题标题】:Change the color of a single *output* cell in jupyter notebook?更改 jupyter notebook 中单个 *output* 单元格的颜色?
【发布时间】:2021-07-02 22:51:39
【问题描述】:

我使用的某些软件包会创建带有黑色文本的图像。不幸的是,我的 Jupyter 主题很暗,因此很难阅读此文本。这些包没有参数来轻松更改字体颜色。我宁愿不更改我的 jupyter 主题,但最好更改单个 jupyter 单元的 输出 的背景颜色。有一个类似的问题要更改单元格本身的颜色(How to change the background color of a single cell in a jupyter notebook / jupyterlab?),但我想更改输出背景颜色。

【问题讨论】:

标签: python jupyter-notebook jupyter-lab


【解决方案1】:

经过on GitHub 的讨论,我们缩小了同一问题的范围,但由于 ipykernel 版本过时而被另一位用户报告。要解决此问题,请升级您的 ipykernel 版本并确保它高于 4.9:

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

如果由于某种原因无法升级,您可以使用手动更改样式的解决方法:

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

获得一致的深色背景,或使用以下之一:

plt.style.use('seaborn')

plt.style.use('ggplot')

以获得一致的深色背景。这是因为 scanpy 使用 matplotlib 来渲染图形,因此您应该能够根据自己的喜好使用 matplotlib API 调整 matplotlib 渲染设置。有关 matplotlib 样式的更多信息,请参阅the documentation here

【讨论】:

    猜你喜欢
    • 2018-08-31
    • 2020-02-08
    • 1970-01-01
    • 1970-01-01
    • 2014-08-24
    • 1970-01-01
    • 2023-03-28
    • 2014-07-15
    • 1970-01-01
    相关资源
    最近更新 更多