python - 将多个数字保存到一个 pdf-每页四个数字
问题描述
你好朋友们,我是 matplotlib 的新手,我试图将 X 个数字保存到一个 PDF 页面,该页面将在一页中表示 4 个数字
现在我将我拥有的每个图形保存到一个 PDF 文件中,但每个图形在一页中,我希望在一页中有 4 个图形
会喜欢你的帮助
NOTE-self.my_exercises 是一个练习列表,其中的每个练习都有我绘制的日期和重量
到目前为止,这是我的代码
def plot_exercise(self):
pdf = matplotlib.backends.backend_pdf.PdfPages("FullReport.pdf")
for exercise in self.my_exercises:
fig, ax = plt.subplots()
plt.plot(self.my_exercises[exercise].get_dates(), self.my_exercises[exercise].get_weights(), zorder=1)
plt.scatter(self.my_exercises[exercise].get_dates(), self.my_exercises[exercise].get_weights(), s=10,
color='red', zorder=2)
plt.suptitle(exercise[::-1])
plt.setp(ax.xaxis.get_majorticklabels(), rotation=90, ha="right")
plt.gcf().subplots_adjust(bottom=0.20)
#fig.show()
figures.append(fig)
pdf.savefig(fig)
pdf.close()
我在 StackOverflow 中尝试了一些代码,但我发现它们都不能帮助我的情况
解决方案
推荐阅读
- php - SQLSTATE [42S22]:找不到列:1054 未知列 '0'
- apache-kafka - 是否可以在不使用 Kafka Connect 的情况下在 Kafka 中运行 MirrorMaker?
- math - 在旋转系统中寻找到平面的距离
- google-bigquery - 使用 BigQuery 分页和使用 LIMIT 和 OFFSET 时,BQ 计费是否不同?
- python - 如何按其他列分组并获取熊猫中没有 NaT 的最后日期?
- css - 如何为从数据库中提取的数据设置样式
- tensorflow - 循环多个实验时的 TensorFlow OOM
- python - Django中的组基本权限rest api
- powershell - 在没有用户登录的情况下重新启动后显示任务序列完成消息
- python - 测试/训练集惊人的大数组