Dick Thompson
Dick Thompson

Reputation: 609

Plotly offline- is it possible to save multiple charts offline in one script?

In Plotly's offline examples(https://plot.ly/python/offline/), they have a relatively straightforward guide to saving plot html files locally on your computer. The thing is, I can't seem to find a way to name the plot using the py.plot function- it only saves as temp-plot.html.

This means that if I'm running multiple plots in one script, the temp-plot.html will constantly be overwritten and only one plot will be saved. Is there some sort of workaround for this? That doesn't seem to make much sense to me.

Upvotes: 0

Views: 1294

Answers (1)

tripleee
tripleee

Reputation: 189397

The plot() command accepts a filename= parameter so you can say where you want each plot saved separately.

plot([Bar(y=[3, 2, 6])], filename='ick.html')
plot([Bar(y=[5, 9, 5])], filename='poo.html')

If you are generating a static image, not an HTML plot, the image_filename= parameter is the one you're looking for.

Upvotes: 2

Related Questions