我正在尝试让我的 jupyter/python/%matplotlib 图表在深色背景下工作。我想为完整图像设置白色背景颜色,而不是默认透明。
%matplotlib notebook
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
fig.savefig('dummy.png', facecolor='w', transparent=False)
标准响应是使用 facecolor,但这并不能解决问题 here .
请您参考如下方法:
savefig 在 rcParams 中有单独的条目:
plt.rcParams['savefig.facecolor'] = 'black'
