From 90f4ae8dc99e996afe9915b3e7f94a988a390dde Mon Sep 17 00:00:00 2001 From: Karel Vaculik Date: Thu, 7 Sep 2023 08:45:21 +0200 Subject: [PATCH] Finished tables documentation --- docs/configuration.md | 42 ++++---- docs/examples/references.py | 13 ++- docs/examples/table_captions.py | 5 +- docs/examples/table_datatables_definition.py | 19 ++++ docs/examples/table_paging.py | 13 +++ docs/examples/table_scrolling.py | 13 +++ docs/examples/table_searching.py | 14 +++ docs/examples/table_sorting.py | 6 ++ docs/examples/table_styling.py | 19 ++++ docs/tables.md | 78 +++++++++++--- examples/longer_report.html | 102 +++++++++---------- examples/longer_report.py | 16 +-- examples/report.html | 46 ++++----- examples/sample_plots.html | 48 ++++----- pyreball/html.py | 1 - 15 files changed, 285 insertions(+), 150 deletions(-) create mode 100644 docs/examples/table_datatables_definition.py create mode 100644 docs/examples/table_paging.py create mode 100644 docs/examples/table_scrolling.py create mode 100644 docs/examples/table_searching.py create mode 100644 docs/examples/table_styling.py diff --git a/docs/configuration.md b/docs/configuration.md index c05e155..4688561 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -110,27 +110,27 @@ parameters. The following table shows the parameter alternatives between these t of given function. For example, instead of values `yes` and `no`, the functions usually use Boolean values `True` and `False`. -| `config.ini` key | CLI argument | Function argument | Description | -|---------------------------|-----------------------------|------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `toc` | `--toc ` | _N/A_ | Include table of contents. It is included only when there are any headings. Allowed values: `yes`, `no`. | -| `align-tables` | `--align-tables` | `align` in [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) | Horizontal alignment of tables. Allowed values: `left`, `center`, `right`. | -| `table-captions-position` | `--table-captions-position` | `caption_position` in [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) | Caption position. Allowed values: `top`, `bottom`. | -| `numbered-tables` | `--numbered-tables` | `numbered` in [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) | Whether to number tables. Allowed values: `yes`, `no`. | -| `tables-display-option` | `--tables-display-option` | `display_option` in [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) | How to display table. This option is useful for long tables, which should not be displayed fully. Allowed values are: `full` (show the full table), `scrolling` (show the table in scrolling mode on y-axis), `paging` (show the table in paging mode). | -| `tables-paging-sizes` | `--tables-paging-sizes` | `paging_sizes` in [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) | The paging sizes that can be selected. Ignored when `tables-display-option` is not `paging`. Allowed values are integers and string `all` (no matter the case of letters), written as a non-empty comma-separated list. | -| `tables-scroll-y-height` | `--tables-scroll-y-height` | `scroll_y_height` in [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) | Height of the tables when `tables-display-option` is set to `scrolling`. Any string compatible with CSS sizing can be used, e.g. `300px`, `20em`, etc. | -| `tables-scroll-x` | `--tables-scroll-x` | `scroll_x` in [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) | Whether to allow scrolling on the x-axis. If turned off, a wide table is allowed to overflow the main container. It is recommended to turn this on, especially with `tables-display-option` set to `scrolling`, because otherwise the table header won't interact properly when scrolling horizontally. Allowed values: `yes`, `no`. | -| `sortable-tables` | `--sortable-tables` | `sortable` in [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) | Whether to make columns in tables sortable. Allowed values: `yes`, `no`. | -| `tables-search-box` | `--tables-search-box` | `show_search_box` in [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) | Whether to show the search box for the tables. Allowed values: `yes`, `no`. | -| `tables-datatables-style` | `--tables-datatables-style` | `datatables_style` in [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) | Datatables class(es) that affect the tables styling. If multiple classes are provided, separate them either with commas or spaces. See [DataTables documentation](https://datatables.net/manual/styling/classes) with the possible values. | -| `align-plots` | `--align-plots` | `align` in [`plot_graph()`](../api/pyreball_html/#pyreball.html.plot_graph) | Horizontal alignment of plots. Allowed values: `left`, `center`, `right`. | -| `plot-captions-position` | `--plot-captions-position` | `caption_position` in [`plot_graph()`](../api/pyreball_html/#pyreball.html.plot_graph) | Caption position. Allowed values: `top`, `bottom`. | -| `numbered-plots` | `--numbered-plots` | `numbered` in [`plot_graph()`](../api/pyreball_html/#pyreball.html.plot_graph) | Whether to number plots. Allowed values: `yes`, `no`. | -| `matplotlib-format` | `--matplotlib-format` | `matplotlib_format` in [`plot_graph()`](../api/pyreball_html/#pyreball.html.plot_graph) | Format of matplotlib (and thus also seaborn) plots. Allowed values: `png`, `svg`. | -| `matplotlib-embedded` | `--matplotlib-embedded` | `embedded` in [`plot_graph()`](../api/pyreball_html/#pyreball.html.plot_graph) | Whether to embedded matplotlib (and thus also seaborn) plots directly into HTML. Only for svg format. Allowed values: `yes`, `no`. | -| `numbered-headings` | `--numbered-headings` | _N/A_ | Whether to number headings. Allowed values: `yes`, `no`. | -| `page-width` | `--page-width` | _N/A_ | Width of the page container in percentage. Allowed values: An integer in the range 40..100. | -| `keep-stdout` | `--keep-stdout` | _N/A_ | Whether to print the output to stdout too: `yes`, `no`. | +| `config.ini` key | CLI argument | Function argument | Description | +|---------------------------|-----------------------------|------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `toc` | `--toc ` | _N/A_ | Include table of contents. It is included only when there are any headings. Allowed values: `yes`, `no`. | +| `align-tables` | `--align-tables` | `align` in [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) | Horizontal alignment of tables. Allowed values: `left`, `center`, `right`. | +| `table-captions-position` | `--table-captions-position` | `caption_position` in [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) | Caption position. Allowed values: `top`, `bottom`. | +| `numbered-tables` | `--numbered-tables` | `numbered` in [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) | Whether to number tables. Allowed values: `yes`, `no`. | +| `tables-display-option` | `--tables-display-option` | `display_option` in [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) | How to display table. This option is useful for long tables, which should not be displayed fully. Allowed values are: `full` (show the full table), `scrolling` (show the table in scrolling mode on y-axis), `paging` (show the table in paging mode). | +| `tables-paging-sizes` | `--tables-paging-sizes` | `paging_sizes` in [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) | The paging sizes that can be selected. Ignored when `tables-display-option` is not `paging`. Allowed values are integers and string `all` (no matter the case of letters), written as a non-empty comma-separated list. | +| `tables-scroll-y-height` | `--tables-scroll-y-height` | `scroll_y_height` in [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) | Height of the tables when `tables-display-option` is set to `scrolling`. Any string compatible with CSS sizing can be used, e.g. `300px`, `20em`, etc. | +| `tables-scroll-x` | `--tables-scroll-x` | `scroll_x` in [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) | Whether to allow scrolling on the x-axis. If turned off, a wide table is allowed to overflow the main container. It is recommended to turn this on. Allowed values: `yes`, `no`. | +| `sortable-tables` | `--sortable-tables` | `sortable` in [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) | Whether to make columns in tables sortable. Allowed values: `yes`, `no`. | +| `tables-search-box` | `--tables-search-box` | `show_search_box` in [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) | Whether to show the search box for the tables. Allowed values: `yes`, `no`. | +| `tables-datatables-style` | `--tables-datatables-style` | `datatables_style` in [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) | Datatables class(es) that affect the tables styling. If multiple classes are provided, separate them either with commas or spaces. See [DataTables documentation](https://datatables.net/manual/styling/classes) with the possible values. | +| `align-plots` | `--align-plots` | `align` in [`plot_graph()`](../api/pyreball_html/#pyreball.html.plot_graph) | Horizontal alignment of plots. Allowed values: `left`, `center`, `right`. | +| `plot-captions-position` | `--plot-captions-position` | `caption_position` in [`plot_graph()`](../api/pyreball_html/#pyreball.html.plot_graph) | Caption position. Allowed values: `top`, `bottom`. | +| `numbered-plots` | `--numbered-plots` | `numbered` in [`plot_graph()`](../api/pyreball_html/#pyreball.html.plot_graph) | Whether to number plots. Allowed values: `yes`, `no`. | +| `matplotlib-format` | `--matplotlib-format` | `matplotlib_format` in [`plot_graph()`](../api/pyreball_html/#pyreball.html.plot_graph) | Format of matplotlib (and thus also seaborn) plots. Allowed values: `png`, `svg`. | +| `matplotlib-embedded` | `--matplotlib-embedded` | `embedded` in [`plot_graph()`](../api/pyreball_html/#pyreball.html.plot_graph) | Whether to embedded matplotlib (and thus also seaborn) plots directly into HTML. Only for svg format. Allowed values: `yes`, `no`. | +| `numbered-headings` | `--numbered-headings` | _N/A_ | Whether to number headings. Allowed values: `yes`, `no`. | +| `page-width` | `--page-width` | _N/A_ | Width of the page container in percentage. Allowed values: An integer in the range 40..100. | +| `keep-stdout` | `--keep-stdout` | _N/A_ | Whether to print the output to stdout too: `yes`, `no`. | The reason for having multiple options for setting these values is to allow the user to set some properties globally, while others locally as needed for particular scripts. diff --git a/docs/examples/references.py b/docs/examples/references.py index b79ad87..168b87e 100644 --- a/docs/examples/references.py +++ b/docs/examples/references.py @@ -14,7 +14,7 @@ N = 10 np.random.seed(1) df = pd.DataFrame({"x": np.arange(1, N + 1), "y": np.random.random(N) * 4 + 3}) -pb.print_table(df, caption="A data table.") +pb.print_table(df, caption="A data table.", index=False) img_reference = pb.Reference() table_ref = pb.Reference() @@ -28,11 +28,18 @@ f"For example, here is a link to {img_reference('Scatterplot')}." ) pb.print_table( - df, caption="A sortable table with a reference", reference=table_ref, sortable=True + df, + caption="A sortable table with a reference", + reference=table_ref, + sortable=True, + index=False, ) pb.print_table( - df, caption="A table sorted by y column", sorting_definition=("y", "asc") + df, + caption="A table sorted by y column", + sorting_definition=[(df.columns.get_loc("y"), "asc")], + index=False, ) pb.print_h1("Charts") diff --git a/docs/examples/table_captions.py b/docs/examples/table_captions.py index 2b3b9b2..3b7442a 100644 --- a/docs/examples/table_captions.py +++ b/docs/examples/table_captions.py @@ -10,7 +10,4 @@ pb.print_table(df, caption="People with their age.") pb.print_table(df, caption="People with their age.", numbered=False) pb.print_table(df, numbered=False) -pb.print_table( - df, - caption="The table with numbering again. But much bigger caption.", -) +pb.print_table(df, caption="The table with numbering again.") diff --git a/docs/examples/table_datatables_definition.py b/docs/examples/table_datatables_definition.py new file mode 100644 index 0000000..3233af5 --- /dev/null +++ b/docs/examples/table_datatables_definition.py @@ -0,0 +1,19 @@ +import pandas as pd +import pyreball as pb + +df = pd.DataFrame( + [[row * 20 + col for col in range(20)] for row in range(40)], + columns=[f"col_{i}" for i in range(20)], +) +datatables_definition = { + "paging": False, + "scrollCollapse": True, + "scrollY": "400px", + "searching": False, + "order": [(1, "desc")], +} +pb.print_table( + df, + caption="Larger table with custom config.", + datatables_definition=datatables_definition, +) diff --git a/docs/examples/table_paging.py b/docs/examples/table_paging.py new file mode 100644 index 0000000..f88fa87 --- /dev/null +++ b/docs/examples/table_paging.py @@ -0,0 +1,13 @@ +import pandas as pd +import pyreball as pb + +df = pd.DataFrame( + [[row * 20 + col for col in range(20)] for row in range(40)], + columns=[f"col_{i}" for i in range(20)], +) +pb.print_table( + df, + caption="Larger table with paging.", + display_option="paging", + paging_sizes=[5, 10, "All"], +) diff --git a/docs/examples/table_scrolling.py b/docs/examples/table_scrolling.py new file mode 100644 index 0000000..0bed5bc --- /dev/null +++ b/docs/examples/table_scrolling.py @@ -0,0 +1,13 @@ +import pandas as pd +import pyreball as pb + +df = pd.DataFrame( + [[row * 20 + col for col in range(20)] for row in range(40)], + columns=[f"col_{i}" for i in range(20)], +) +pb.print_table( + df, + caption="Larger table with scrolling.", + display_option="scrolling", + scroll_y_height="500px", +) diff --git a/docs/examples/table_searching.py b/docs/examples/table_searching.py new file mode 100644 index 0000000..67e1642 --- /dev/null +++ b/docs/examples/table_searching.py @@ -0,0 +1,14 @@ +import pandas as pd +import pyreball as pb + +df = pd.DataFrame( + { + "name": ["Bob", "Carol", "Alice", "Dave"], + "age": [23, 5, 22, 54], + } +) +pb.print_table( + df, + caption="Table with a search box.", + show_search_box=True, +) diff --git a/docs/examples/table_sorting.py b/docs/examples/table_sorting.py index 6ad5219..b7a679c 100644 --- a/docs/examples/table_sorting.py +++ b/docs/examples/table_sorting.py @@ -18,3 +18,9 @@ caption="Table sorted by name (ASC) and age (DESC).", sorting_definition=[(1, "asc"), (2, "desc")], ) +pb.print_table( + df, + caption="The same table, but without the index.", + index=False, + sorting_definition=[(0, "asc"), (1, "desc")], +) diff --git a/docs/examples/table_styling.py b/docs/examples/table_styling.py new file mode 100644 index 0000000..c937b5e --- /dev/null +++ b/docs/examples/table_styling.py @@ -0,0 +1,19 @@ +import pandas as pd +import pyreball as pb + +df = pd.DataFrame( + { + "name": ["Bob", "Carol", "Alice", "Dave"], + "age": [23, 5, 22, 54], + } +) +pb.print_table( + df, + caption="Style set to 'compact'.", + datatables_style="compact", +) +pb.print_table( + df, + caption="Style set to 'compact' and 'display'.", + datatables_style=["compact", "display"], +) diff --git a/docs/tables.md b/docs/tables.md index ed30a63..1e35ec3 100644 --- a/docs/tables.md +++ b/docs/tables.md @@ -1,11 +1,12 @@ # Tables Pyreball allows printing [pandas DataFrame](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html) objects -into HTML tables by using [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) function. +into HTML tables with [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) function. +Moreover, Pyreball uses [DataTables](https://datatables.net/) library to add styling and interactivity to the tables. ## Basic Usage -The simplest usage is to provide just the `DataFrame` object: +The simplest usage is to provide just a `DataFrame` object: {{ inline_source("docs/examples/table_simplest.py") }} @@ -14,18 +15,21 @@ The simplest usage is to provide just the `DataFrame` object: ## Captions All tables are numbered by default, which causes creation of `Table 1.` table caption above. -It is possible to provide custom caption via `caption` parameter, as well as to control the numbering of form `Table k.` -via `numbered` parameter. +It is possible to provide custom caption text via `caption` parameter. +To control whether `Table k.` prefix should be displayed, one can use `numbered` Boolean parameter. {{ inline_source("docs/examples/table_captions.py") }} -Note that internally all tables are numbered, even though the numbering might be turned off. +!!! note + + All tables are internally numbered, even though the numbering might be turned off for specific tables, as shown + in the previous example. ## Caption Position -By default, the caption is positioned at the top of the table. +By default, the caption is positioned above the table. The position can be controlled by `caption_position` parameter, which can be set either to `top` or `bottom`., {{ inline_source("docs/examples/table_caption_position.py") }} @@ -54,21 +58,69 @@ The following snippet shows the usage of both parameters. !!! note Although the columns in `sorting_definition` are indexed from 0, it is necessary to take into account - also the index when it is displayed. To hide the index, set `index` parameter + also the table index when it is displayed. To hide the index, set `index` parameter of [`print_table()`](../api/pyreball_html/#pyreball.html.print_table) method to `False`. - `index` parameter is one of the `kwargs` that are passed to pandas `to_html()` method. + `index` parameter is one of the `kwargs` parameters that are passed to pandas `to_html()` method. {{ inline_source("docs/examples/table_sorting.py") }} - + ## Dealing with Large Tables -TBD +Each table is fully displayed by default. This is caused by `display_option` parameter's default value `full`. +However, this might not be practical for large tables. + +One solution is to allow vertical scrolling of the table by setting `display_option` to `scrolling`. +To change the default height of the table, set also `scroll_y_height` parameter. + +{{ inline_source("docs/examples/table_scrolling.py") }} + + + +!!! note + + By default, Pyreball turns on horizontall scrolling on each table as can be seen in the previous example. + You can turn it off by setting, `scroll_x` parameter to `False`, which might cause the table to overflow + the container. + +Another option is to set `display_option` to `paging`. This option can be further customized by providing custom page +sizes through `paging_sizes` parameter. Currently, `paging_sizes` takes a list of integers mixed with string `All` (the +case of the letters does nto matter, so it can be `all` or `ALL` as well). When `All` is used, Pyreball interprets it as +showing all entries on a single page. + +{{ inline_source("docs/examples/table_paging.py") }} + + + +## Searching + +To allow searching within a table, just set `show_search_box` to `True`. + +{{ inline_source("docs/examples/table_searching.py") }} + + ## Styling -TBD +Tables are also styled with the help of [DataTables](https://datatables.net/) library. +The default styling class used is `display`. +To change the styling, use parameter `datatables_style`, which takes either a single string with a class name, +or a list of class names. +Usable class names are listed in the styling reference +of [Datatables documentation](https://datatables.net/manual/styling/classes). + +{{ inline_source("docs/examples/table_styling.py") }} + + + +## Custom DataTables Configuration + +Most of the parameters in the previous sections were just setting up the parameters of `DataTable` JavaScript object +in some predefined manner. +It is possible to completely override such parameters by providing custom dictionary via `datatables_definition` +parameter. This dictionary is then serialized into JSON and passed to the `DataTable` JavaScript object. + +{{ inline_source("docs/examples/table_datatables_definition.py") }} -For more options, see the styling reference -in [Datatables documentation](https://datatables.net/manual/styling/classes). \ No newline at end of file + diff --git a/examples/longer_report.html b/examples/longer_report.html index 31fc9bf..d8ac44c 100644 --- a/examples/longer_report.html +++ b/examples/longer_report.html @@ -188,13 +188,7 @@

1  Displaying Texts
However, we can use special function to write text into a <br> element.

-
-It is possible to pass several values and optionally a separator. -The values will be joined and automatically converted to strings, as with the following number and list. -42 -[11, 13, 19] -Newline characters can be converted to <br> elements by using replace_newlines_with_br parameter. -
+

It is possible to pass several values and optionally a separator.
The values will be joined and automatically converted to strings, as with the following number and list.
42
[11, 13, 19]

1.1  Basic String-wrapping Formatting Functions

This is a text with bold word and with emphasised word.You can also use inline code formatting.
In the previous section, we pasted string values on separate lines. Let's use lists instead:
  • Each argument is one element in the list
  • We can even make nested lists as with the following ordered list:
    1. First
    2. Second
  • And we can of course mix the lists:
    • Nested list again, but now an unordered one.
@@ -281,7 +275,7 @@

2.1  Tables and Plots - 2023-09-06T21:19:16.968432 + 2023-09-07T07:51:27.822300 image/svg+xml @@ -317,12 +311,12 @@

2.1  Tables and Plots - - + @@ -361,7 +355,7 @@

2.1  Tables and Plots - + @@ -395,7 +389,7 @@

2.1  Tables and Plots - + @@ -440,7 +434,7 @@

2.1  Tables and Plots - + @@ -494,7 +488,7 @@

2.1  Tables and Plots - + @@ -570,12 +564,12 @@

2.1  Tables and Plots - - + @@ -631,7 +625,7 @@

2.1  Tables and Plots - + @@ -673,7 +667,7 @@

2.1  Tables and Plots - + @@ -688,7 +682,7 @@

2.1  Tables and Plots - + @@ -703,7 +697,7 @@

2.1  Tables and Plots - + @@ -718,7 +712,7 @@

2.1  Tables and Plots - + @@ -733,7 +727,7 @@

2.1  Tables and Plots - + @@ -748,7 +742,7 @@

2.1  Tables and Plots - + @@ -797,7 +791,7 @@

2.1  Tables and Plots +" clip-path="url(#p95c867e798)" style="fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square"/> 2.1  Tables and Plots - + @@ -958,7 +952,7 @@

2.2  References to Plots and - 2023-09-06T21:19:16.995472 + 2023-09-07T07:51:27.848888 image/svg+xml @@ -991,7 +985,7 @@

2.2  References to Plots and - 2.2  References to Plots and z " style="stroke: #ffffff; stroke-width: 0.48"/> - - - - - - - - - - - + + + + + + + + + + + - - + @@ -1064,7 +1058,7 @@

2.2  References to Plots and - + @@ -1098,7 +1092,7 @@

2.2  References to Plots and - + @@ -1143,7 +1137,7 @@

2.2  References to Plots and - + @@ -1197,7 +1191,7 @@

2.2  References to Plots and - + @@ -1273,12 +1267,12 @@

2.2  References to Plots and - - + @@ -1334,7 +1328,7 @@

2.2  References to Plots and - + @@ -1376,7 +1370,7 @@

2.2  References to Plots and - + @@ -1391,7 +1385,7 @@

2.2  References to Plots and - + @@ -1406,7 +1400,7 @@

2.2  References to Plots and - + @@ -1421,7 +1415,7 @@

2.2  References to Plots and - + @@ -1436,7 +1430,7 @@

2.2  References to Plots and - + @@ -1451,7 +1445,7 @@

2.2  References to Plots and - + @@ -1512,7 +1506,7 @@

2.2  References to Plots and - + diff --git a/examples/longer_report.py b/examples/longer_report.py index 4785d09..e971cfd 100644 --- a/examples/longer_report.py +++ b/examples/longer_report.py @@ -18,11 +18,11 @@ pb.print("
") pb.print_div( "It is possible to pass several values and optionally a separator.", - "The values will be joined and automatically converted to strings, as with the following number and list.", + "The values will be joined and automatically converted to strings, " + "as with the following number and list. ", 42, [11, 13, 19], - "Newline characters can be converted to <br> elements by using replace_newlines_with_br parameter.", - sep="\n", + sep="
", ) pb.print_h2("Basic String-wrapping Formatting Functions") @@ -74,9 +74,10 @@ def factorial(n): pb.print_code_block(inspect.getsource(factorial)) pb.print_div( - f"Before going further, let's return to the very first function we used: {pb.code('set_title')}. " - f"As the name suggests, it sets the title of the HTML page. It is optional and can be actually placed " - f"in any part of the report." + f"Before going further, let's return to the very first function we used: " + f"{pb.code('set_title')}. " + f"As the name suggests, it sets the title of the HTML page. " + f"It is optional and can be actually placed in any part of the report." ) pb.print_h1("Inspecting Data") @@ -101,7 +102,8 @@ def factorial(n): table_ref = pb.Reference() pb.print_div( f"It is also possible to create references to tables and figures. " - f"For example Table {table_ref} shows sortable columns and Fig. {img_reference} displays a scatterplot." + f"For example Table {table_ref} shows sortable columns and Fig. {img_reference} " + f"displays a scatterplot." ) pb.print_table( df, diff --git a/examples/report.html b/examples/report.html index e05854d..d329c97 100644 --- a/examples/report.html +++ b/examples/report.html @@ -220,7 +220,7 @@

2  Tables and Plots - 2023-09-06T21:19:16.259224 + 2023-09-07T07:51:27.121152 image/svg+xml @@ -256,12 +256,12 @@

2  Tables and Plots - - + @@ -321,7 +321,7 @@

2  Tables and Plots - + @@ -388,7 +388,7 @@

2  Tables and Plots - + @@ -404,7 +404,7 @@

2  Tables and Plots - + @@ -432,7 +432,7 @@

2  Tables and Plots - + @@ -448,7 +448,7 @@

2  Tables and Plots - + @@ -464,7 +464,7 @@

2  Tables and Plots - + @@ -480,7 +480,7 @@

2  Tables and Plots - + @@ -496,7 +496,7 @@

2  Tables and Plots - + @@ -571,12 +571,12 @@

2  Tables and Plots - - + @@ -613,7 +613,7 @@

2  Tables and Plots - + @@ -629,7 +629,7 @@

2  Tables and Plots - + @@ -645,7 +645,7 @@

2  Tables and Plots - + @@ -661,7 +661,7 @@

2  Tables and Plots - + @@ -677,7 +677,7 @@

2  Tables and Plots - + @@ -693,7 +693,7 @@

2  Tables and Plots - + @@ -709,7 +709,7 @@

2  Tables and Plots - + @@ -725,7 +725,7 @@

2  Tables and Plots - + @@ -800,7 +800,7 @@

2  Tables and Plots +" clip-path="url(#pb8fd37d0a8)" style="fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square"/> 2  Tables and Plots - + diff --git a/examples/sample_plots.html b/examples/sample_plots.html index 18b00c0..025f99a 100644 --- a/examples/sample_plots.html +++ b/examples/sample_plots.html @@ -221,7 +221,7 @@

Sample Plots - 2023-09-06T21:19:15.479851 + 2023-09-07T07:51:26.360751 image/svg+xml @@ -258,7 +258,7 @@

Sample Plots +" clip-path="url(#p74033e8ead)" style="fill: #4879ae"/> Sample Plots +" clip-path="url(#p74033e8ead)" style="fill: #4879ae"/> Sample Plots +" clip-path="url(#p74033e8ead)" style="fill: #4879ae"/> - - + @@ -314,7 +314,7 @@

Sample Plots - + @@ -353,7 +353,7 @@

Sample Plots - + @@ -425,12 +425,12 @@

Sample Plots - - + @@ -466,7 +466,7 @@

Sample Plots - + @@ -479,7 +479,7 @@

Sample Plots - + @@ -492,7 +492,7 @@

Sample Plots - + @@ -505,7 +505,7 @@

Sample Plots - + @@ -539,7 +539,7 @@

Sample Plots - + @@ -579,7 +579,7 @@

Sample Plots - + @@ -648,13 +648,13 @@

Sample Plots - + - + - + Sample Plots + @@ -755,19 +755,19 @@

Sample Plots
+
-