From dbdbc5f19e0cc329ff1b0c71e616c8c2e9283e45 Mon Sep 17 00:00:00 2001 From: Jens Diemer Date: Sun, 15 Mar 2020 13:12:17 +0100 Subject: [PATCH 1/2] Update advanced.rst Bugfix plot example. --- docs/user/advanced.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user/advanced.rst b/docs/user/advanced.rst index d331b76..81a5897 100644 --- a/docs/user/advanced.rst +++ b/docs/user/advanced.rst @@ -66,7 +66,7 @@ Let's plot all the text present on the table's PDF page. :: - >>> camelot.plot(tables[0], kind='text') + >>> plt = camelot.plot(tables[0], kind='text') >>> plt.show() .. tip:: From 1e050e1960d8e0f3acf8c78f74619801e9726586 Mon Sep 17 00:00:00 2001 From: Vinayak Mehta Date: Fri, 14 Aug 2020 02:27:07 +0530 Subject: [PATCH 2/2] Remove plt.show() usage --- docs/user/advanced.rst | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/docs/user/advanced.rst b/docs/user/advanced.rst index 81a5897..b482022 100644 --- a/docs/user/advanced.rst +++ b/docs/user/advanced.rst @@ -66,8 +66,7 @@ Let's plot all the text present on the table's PDF page. :: - >>> plt = camelot.plot(tables[0], kind='text') - >>> plt.show() + >>> camelot.plot(tables[0], kind='text').show() .. tip:: Here's how you can do the same with the :ref:`command-line interface `. @@ -93,8 +92,7 @@ Let's plot the table (to see if it was detected correctly or not). This plot typ :: - >>> camelot.plot(tables[0], kind='grid') - >>> plt.show() + >>> camelot.plot(tables[0], kind='grid').show() .. tip:: Here's how you can do the same with the :ref:`command-line interface `. @@ -118,8 +116,7 @@ Now, let's plot all table boundaries present on the table's PDF page. :: - >>> camelot.plot(tables[0], kind='contour') - >>> plt.show() + >>> camelot.plot(tables[0], kind='contour').show() .. tip:: Here's how you can do the same with the :ref:`command-line interface `. @@ -141,8 +138,7 @@ Cool, let's plot all line segments present on the table's PDF page. :: - >>> camelot.plot(tables[0], kind='line') - >>> plt.show() + >>> camelot.plot(tables[0], kind='line').show() .. tip:: Here's how you can do the same with the :ref:`command-line interface `. @@ -164,8 +160,7 @@ Finally, let's plot all line intersections present on the table's PDF page. :: - >>> camelot.plot(tables[0], kind='joint') - >>> plt.show() + >>> camelot.plot(tables[0], kind='joint').show() .. tip:: Here's how you can do the same with the :ref:`command-line interface `. @@ -187,8 +182,7 @@ You can also visualize the textedges found on a page by specifying ``kind='texte :: - >>> camelot.plot(tables[0], kind='textedge') - >>> plt.show() + >>> camelot.plot(tables[0], kind='textedge').show() .. tip:: Here's how you can do the same with the :ref:`command-line interface `. @@ -375,8 +369,7 @@ Let's see the table area that is detected by default. :: >>> tables = camelot.read_pdf('edge_tol.pdf', flavor='stream') - >>> camelot.plot(tables[0], kind='contour') - >>> plt.show() + >>> camelot.plot(tables[0], kind='contour').show() .. tip:: Here's how you can do the same with the :ref:`command-line interface `. @@ -396,8 +389,7 @@ To improve the detected area, you can increase the ``edge_tol`` (default: 50) va :: >>> tables = camelot.read_pdf('edge_tol.pdf', flavor='stream', edge_tol=500) - >>> camelot.plot(tables[0], kind='contour') - >>> plt.show() + >>> camelot.plot(tables[0], kind='contour').show() .. tip:: Here's how you can do the same with the :ref:`command-line interface `. @@ -472,8 +464,7 @@ Let's plot the table for this PDF. :: >>> tables = camelot.read_pdf('short_lines.pdf') - >>> camelot.plot(tables[0], kind='grid') - >>> plt.show() + >>> camelot.plot(tables[0], kind='grid').show() .. figure:: ../_static/png/short_lines_1.png :alt: A plot of the PDF table with short lines @@ -484,8 +475,7 @@ Clearly, the smaller lines separating the headers, couldn't be detected. Let's t :: >>> tables = camelot.read_pdf('short_lines.pdf', line_scale=40) - >>> camelot.plot(tables[0], kind='grid') - >>> plt.show() + >>> camelot.plot(tables[0], kind='grid').show() .. tip:: Here's how you can do the same with the :ref:`command-line interface `.