Example #1
0
def example_03(pdf: bool = False):
    page = es.Page(title="Markdown Page", max_width=600)
    page += "tests/resources/markdown.md"
    page.save_html("page03-markdown.html")

    if pdf:
        page.save_pdf("page03-markdown.pdf")
Example #2
0
def example_02(pdf: bool = False):
    page = es.Page(title="Matplotlib Page")

    _ = df.plot.hist(alpha=0.4, bins=30)
    fig = plt.gcf()
    fig.tight_layout()

    _ = df.plot.hist(alpha=0.4, bins=30)
    fig2 = plt.gcf()
    fig2.tight_layout()
    fig2.set_size_inches(4, 3)

    page[0][0] = df[:10], fig
    page[0][1] = ({"fig": fig}, {"table": df[:10]})
    page[0][2] = es.CardRowEqual(children=[{
        "fig": fig
    }, {
        "table": df[:10]
    }][::-1])
    page[0][3] = {"text": lorem}, {"table": df[:10]}
    page[0][4] = fig
    page[0][5] = fig2

    page.save_html("page02-mpl.html")

    if pdf:
        page.save_pdf("page02-mpl.pdf")
Example #3
0
def example_01(pdf: bool = False):
    page = es.Page(title="Columns Page",
                   navbrand="esparto",
                   table_of_contents=2)

    page["Section One"]["Row One"]["Column One"] = lorem
    page["Section Two"] = es.Section()
    page["Section Three"] = es.CardSection()
    page["Section Four"] = es.Section()
    page["Section Five"] = es.CardSection()

    for i in range(1, 5):
        page["Section Two"][f"Row {i}"] = [(image, lorem)
                                           for _ in range(1, i + 1)]
        page["Section Three"][f"Row {i}"] += [
            lorem if j % 2 == 0 else {
                "Card Title": image
            } for j in range(1, i + 1)
        ]
        page["Section Four"][f"Row {i}"] += [{
            "Column Title": lorem
        } for _ in range(1, i + 1)]
        page["Section Five"][f"Row {i}"] += [{
            "Card Title": lorem
        } for _ in range(1, i + 1)]

    page.save_html("page01.html")

    if pdf:
        page.save_pdf("page01.pdf")
Example #4
0
 def test_pdf_output(content, tmp_path):
     if "bokeh" not in content._dependencies:
         page = es.Page(children=[content])
         path: Path = tmp_path / "my_page.pdf"
         page.save_pdf(str(path))
         size = path.stat().st_size
         assert size > 1000
Example #5
0
def example_06(pdf: bool = False):
    page = es.Page(title="Bokeh Page")

    fig = bkp.figure(title="One")
    fig.circle("A", "B", source=df)  # type: ignore

    page[0][0] = df[:10], fig
    page[0][1] = ({"fig": fig}, {"table": df[:10]})
    page[0][2] = es.CardRowEqual(children=[{
        "fig": fig
    }, {
        "table": df[:10]
    }][::-1])
    page[0][3] = {"text": lorem}, {"table": df[:10]}
    page[0][4] = ({"fig": fig}, {"fig": fig})

    fig2 = bkp.figure(title="Two", width=400, height=300)
    fig2.circle("A", "B", source=df)  # type: ignore
    page[0][5] = fig2

    page.save_html("page06-bokeh.html")
Example #6
0
def example_04(pdf: bool = False):
    page = es.Page(title="Plotly Page")

    fig = px.scatter(data_frame=df, x="A", y="B")
    fig2 = px.scatter(data_frame=df, x="A", y="B", width=400, height=300)

    page[0][0] = df[:10], fig
    page[0][1] = ({"fig": fig}, {"table": df[:10]})
    page[0][2] = es.CardRowEqual(children=[{
        "fig": fig
    }, {
        "table": df[:10]
    }][::-1])
    page[0][3] = {"text": lorem}, {"table": df[:10]}
    page[0][4] = ({"fig": fig}, {"fig": fig})
    page[0][5] = fig
    page[0][6] = fig2

    page.save_html("page04-plotly.html")

    if pdf:
        page.save_pdf("page04-plotly.pdf")