Jupyterlab 暗黑模式下使用 Matplotlib 画图有时无法显示图片的坐标轴信息,这是需要调整 matplotlib 的画图显示风格,以使用暗黑模式的 jupyterlab. 本篇所有代码在 jupyterlab 中使用。 
更改 matplotlib 的 style
matplotlib 提供了很多种显示风格,查看所有的风格,可以使用如下命令:
| 12
 3
 
 | from matplotlib import style
 style.available
 
 | 
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 
 | ['Solarize_Light2','_classic_test_patch',
 '_mpl-gallery',
 '_mpl-gallery-nogrid',
 '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']
 
 | 
更改风格为暗黑背景:
| 1
 | style.use("dark_background")
 | 
此时,再画图将能够适应 jupyterlab 的暗黑模式。