开发者

Writing a table to a matplotlib pdf file

开发者 https://www.devze.com 2023-04-12 03:25 出处:网络
I am using matplotlib and a modified version of this example to generate plots in pdf files. So I am plotting each plot on a single page and the results are just fine.

I am using matplotlib and a modified version of this example to generate plots in pdf files. So I am plotting each plot on a single page and the results are just fine.

Now I would like to list all the data used in the plots in a rathe开发者_StackOverflowr long table. This table should be placed below the last plot (so not each plot should get its own table).

Is there a way to plot LaTeX like tables in a pdf file using matplotlib?


In principle, you can place almost any TeX stuff onto a plot using something like plt.text(1,2,r'$a^2+b^2=42$'). For aligning equations things like eqnarray work as well, like this. Just don't forget to use raw strings, for otherwise python can misinterpret TeX commands which start with backslashes.


Unless using a plot to write text, I think it is save to say, that it is not possible to only write a table to a matplotlib pdf output file.

Currently I am using tex to write the table and pyPdf to merge the two results. I think this is the cleanest solution to the problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消