Plot

By creating an index.html file in the correct directory, an interactive plot can be created. The easiest way to create an interactive plot is to use Plotly, but you can also handcraft an HTML file as long as the file is placed in:

{ARTIFACT_FOLDER}/index.html

Plotly

Following is an example using Plotly:

import polars as pl
import plotly.express as px
import os

def transform():
    # example data
    df = pl.DataFrame({
        "Category": ["Group A", "Group B", "Group C", "Group D"],
        "Value": [45, 72, 38, 91]
    })
    
    # Generate the bar chart using Plotly
    fig = px.bar(df.to_pandas(), x="Category", y="Value", title="Simple Bar Chart")
    
    # Save the chart as HTML
    fig.write_html(f"{os.environ['ARTIFACT_FOLDER']}/index.html")
    
    return df

Last updated