2

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 rather 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?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Woltan
  • 13,723
  • 15
  • 78
  • 104

2 Answers2

0

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.

Community
  • 1
  • 1
ev-br
  • 24,968
  • 9
  • 65
  • 78
  • @N.N.: If ams extensions (like `align` and its relatives) work, then of course, there's no reason to use `eqnarray`. For what I've tried, at least in an older version of `matplotlib`, I didn't manage to get it to work. Hence `eqnarray`. – ev-br Oct 11 '11 at 15:39
0

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.

Woltan
  • 13,723
  • 15
  • 78
  • 104