> For the complete documentation index, see [llms.txt](https://docs.dataspace.ch/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dataspace.ch/platform/transformation/plot.md).

# 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](https://plotly.com/), but you can also handcraft an HTML file as long as the file is placed in:

{% hint style="info" %}
`{ARTIFACT_FOLDER}/index.html`
{% endhint %}

#### Plotly

Following is an example using Plotly:

```python
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
```

<figure><img src="/files/kO6bAADI2FQbBEEBcrXx" alt=""><figcaption></figcaption></figure>
