matplotlib内置样式全部显示白底

matplotlib built-in styles all display white background

全部。 python 和一般编程的新手,我对 matplotlib 的内置样式有疑问。也就是说,无论我选择什么样式,图形背景总是显示为白色。这是我试过的代码:

import matplotlib.pyplot as plt

input_values = list(range(1,6))
squares = [i**2 for i in range(1,6)]

plt.style.use('seaborn')

fig, ax = plt.subplots()
ax.plot(input_values, squares, linewidth=3)

ax.set_title("Square Numbers", fontsize=24)
ax.set_xlabel("Value", fontsize=14)
ax.set_ylabel("Square of Values", fontsize=14)

ax.tick_params(axis="both", labelsize=14)

plt.show()

这是我收到的:graph

当显示屏第一次出现时,我可以短暂地看到正确样式的背景,但一秒钟之内它就变白了。

我使用 Anaconda (python v. 3.8.3) 并尝试从 Sublime Text 3 和终端 (Git Bash) 运行 如果什么都值。

编辑:在我的 phone 上打开图像确实显示了正确的样式,但是无论出于何种原因在我的计算机上打开图像时它都没有显示。

事实证明这只是我的显示器显示设置的问题,调整亮度和对比度解决了这个问题!