python - 子图过于紧凑
问题描述
我正在尝试使用 matplotlib 绘制三个图形,但图像的显示方式不清楚,我尝试使用plt.tight_layout()和plt.subplots_adjust(left=0.1, bottom=0.1, right=0.5, top =1.0, wspace=0.5, hspace=0.5),但它们都不起作用。
我不太确定问题是我正在使用的IDE(Visual Studio Code),还是有任何方法可以绘制单曲图但在同一个python函数中。如果有人知道如何改进图表的显示方式。
def program_graph(year):
...
fig,axes = plt.subplots(nrows=3, ncols = 1)
risk_info_srv_evesa.plot.bar(ax = axes[0])
risk_info_act_pln.plot.bar(ax = axes[1])
final_db.plot.bar(ax = axes[2])
axes[0].title.set_text('SRV-EVESOS per Program')
axes[1].title.set_text('Action Plan per Program')
axes[2].title.set_text('SRV-EVESOS Vs Action Plan')
plt.tight_layout()
plt.subplots_adjust(left=0.4, bottom=0.1, right=0.5, top=1.0, wspace=0.5, hspace=0.5)
plt.show()
我认为最好的解决方案是单独显示每个图表,但我不想为每个图表实现不同的功能。有谁知道如何解决这个问题?
解决方案
推荐阅读
- forms - 使用 RestSharp 发布表单数据
- javascript - Firestore 实时监听器和成本
- google-analytics - Google Analytics 始终将“平均页面加载时间”显示为零
- android - 在没有 gradle 插件的情况下设置 New Relic
- python - 使用 requirements.txt 在新的 conda 环境中自动安装来自 conda 通道和 pip 的包
- libgit2 - 使用 libgit2sharp 将远程分支拉到本地分支的正确方法是什么?
- python-3.x - 如何指定 VS 代码绑定以将文件从 /tmp 上传到 Azure 函数中的 blob 存储
- javascript - 从数组中获取变量然后传递给nodejs请求模块上的url
- sql - 以另一个表为条件的 SQL
- html - 如何让动画从 div 的当前位置开始?