1

我在 PyQt MainWindow 中显示了一个条形图和其他数据。我需要能够在纸上打印此图和数据,但不知道如何去做。

我知道如何使用将绘图保存到 pdfprint_figure然后发送到打印机,但这不允许我将附加数据放在与绘图相同的页面上。我环顾四周,无法找到一种方法来将绘图与打印在其下方的数据一起打印在一页上。有什么建议么?

4

1 回答 1

1
text_str = '''Some additional very long text
that spans over a few lines and is
very very very very very boring
but it's sole purpose is demonstration
so we can live with that'''

# make figure and axes
fig, ax = plt.subplots(1, 1)
# shove the bottom of the axes up
fig.subplots_adjust(bottom=.3)
# add the text
fig.text(0, 0, text_str, va='bottom')
# force draw
plt.draw()

在此处输入图像描述

于 2013-08-20T19:13:03.090 回答