python - matplotlib 内置样式全部显示白色背景
问题描述
全部。通常是 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) 运行,如果这值得的话。
编辑:在我的手机上打开图像确实显示了正确的样式,但无论出于何种原因,在我的计算机上打开图像时它都没有出现。
解决方案
事实证明,这只是我的显示器显示设置的问题,调整亮度和对比度可以解决问题!
推荐阅读
- laravel - ck 编辑器内容未在前端显示为 html
- visual-studio-code - 使用鼠标滚轮在集成终端中滚动
- android - 为什么 SetOnClickListener 并不总是有效?
- flutter - 如何使用flutter dio connect-type multipart?
- automation - testng-为场景示例打开多个浏览器
- python - python - 通过 smtplib 错误在本地发送电子邮件
- r - 计算R中不同日期范围的闰日
- typescript - 如何转换 Promise
> 到可观察的 ? - postgresql - 覆盖索引似乎不是最佳的。在执行计划中预期 0 个堆提取
- google-apps-script - 基于单元格的面值运行而忽略公式的 Google 表格脚本