Jupyter 深色主题图表

Jupyter dark themes graphs

我安装了 jupyter 深色主题。我的图表有时看起来很正常,有时很难读取 x、y 轴。相同的 matplotlib 代码给出不同的结果 Easy to read graph

Hard to read graph

当你使用绘图功能时,做这样的事情。

ax = df.plot()  # whatever type

然后要改变坐标轴的颜色,可以使用这个函数。

ax.tick_params(color='w', labelcolor='w')

它将标签的颜色更改为白色,您可以使用任何您喜欢的其他颜色;请参阅相关文档。

您可以在matplotlib 中设置样式。 你想要 dark_background

from matplotlib import style
print(style.available)

#['Solarize_Light2',
# '_classic_test_patch',
# 'bmh',
# 'classic',
# 'dark_background',
# 'fast',
# 'fivethirtyeight',
# 'ggplot',
# 'grayscale',
# 'seaborn',
# 'seaborn-bright',
# 'seaborn-colorblind',
# 'seaborn-dark',
# 'seaborn-dark-palette',
# 'seaborn-darkgrid',
# 'seaborn-deep',
#'seaborn-muted',
# 'seaborn-notebook',
# 'seaborn-paper',
# 'seaborn-pastel',
# 'seaborn-poster',
# 'seaborn-talk',
#'seaborn-ticks',
# 'seaborn-white',
# 'seaborn-whitegrid',
# 'tableau-colorblind10']