pythonmatplotlibpython-camelot

Trying to plot a pdf table using camelot-py, but no table comes up


I am trying to plot the table to debug and find table coordinates, however the plot never appears on the screen. Camelot has built in functions that use the matplotlib library to plot the tables. I have all the dependencies downloaded for camelot, but I can't seem to figure out how to get the figure to appear.


tables = camelot.read_pdf('example.pdf', flavor = 'lattice')

print(tables[0].parsing_report)

plt = camelot.plot(tables[0], kind='grid')
plt.show()


Solution

  • I just needed to add the Tkinter .mainloop() function after the .show() function to keep the figure up until I close it. without it, the figure closes immediately so that the code can run all the way through.