可能已经有点晚了,但这里提供一个未来参考的解决方案:
1- 进入 PyCharm > Preferences,然后在搜索栏中输入 "Invert image outputs for dark themes"。
2- 转到 Language & Frameworks > Jupyter 并取消选择 "Invert image outputs for dark themes" 复选框。
3- 重新启动 PyCharm 以使选项生效。
fig = plt.figure()
fig.patch.set_facecolor('white')
plt.gca().patch.set_facecolor('white')
plt.rcParams['figure.facecolor'] = 'white'
ipython_kernel_config.py
并将其放置在正确的位置(默认情况下为~/.ipython/profile_default
),其中包含以下行:c.InlineBackend.rc = {'figure.facecolor': 'white'}
import seaborn as sns
sns.set_context('notebook')
sns.set_style('white')
对我来说临时解决方法是在单元格末尾显式调用plt.show()
。
我也在寻找更好的解决方案。