ztawil
ztawil8mo ago

plotly in markdown

Have you had luck adding a Plotly fig to a markdown section? I could've sworn it worked before. But now I'm getting it exported as HTML text instead of rendering I've tried
test_fig = px.bar(x=["a", "b"], y=[1, 2])
mo.md(f"#My Chart {test_fig}")
test_fig = px.bar(x=["a", "b"], y=[1, 2])
mo.md(f"#My Chart {test_fig}")
and
mo.md(f"#My Chart {test_fig.to_html()}")
mo.md(f"#My Chart {test_fig.to_html()}")
No description
No description
2 Replies
Myles Scolnick
Myles Scolnick8mo ago
can you try mo.as_html? mo.as_html runs through our special formatters which handles plotly rendering correctly. mo.Html(fig.to_html())will just try to render the output from fig.to_html() which is raw html and may be too large
ztawil
ztawilOP8mo ago
Dope, thanks