Skip to content

plotly.io.write_html return #3599

Closed
Closed
@radcoreai

Description

@radcoreai

Hello!

I am trying to convert a plotly plot to an HTML embeddable div (reproducible example below):

import plotly.express as px
import plotly

fig = px.scatter([1,2], [3,4])
html = plotly.io.write_html(fig, "fig.html")


type(html)
NoneType

While the string representation of the HTML is indeed written to the file, the documentation clearly says that the method returns the string representation.

Returns
Representation of figure as an HTML div string

As for my use case it would be great to have the string directly returned so I can use it externally (to avoid an useless write-read operation each time I want to generate a HTML plot). Either that or let's update the docs to remove the confusion?

I could solve it either way; Let me know what you think would be the best solution.

Thank you!

Metadata

Metadata

Assignees

Labels

P3backlogbugsomething broken

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions