Exporting visualisation html for plotly charts (with plotly.io)

Hello everyone,

I was wondering if there is a simple/recommended way to export the HTML for a visualization in order to show it on another page without doing an embed. We are in the situation where the Redash environment is not reachable from the outside.

Plotly itself allows to generate JSON/HTML with the following example:

import plotly.express as px
import pandas as pd
import plotly.io as pio

df = pd.DataFrame({"x": [1, 2, 3], "SF": [4, 1, 2], "Montreal": [2, 4, 5]})
fig = px.bar(df, x="x", y=["SF", "Montreal"], barmode="group")
pio.write_html(fig, file="chart.html")

What would be the best approach/alternative in Plotly to achieve this?


AFAIK Redash doesn’t support this at all.