0

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.

Dick Thompson
  • 599
  • 1
  • 12
  • 26

1 Answers1

2

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.

tripleee
  • 175,061
  • 34
  • 275
  • 318
  • so I tried that and it didn't work- could you maybe try an example? This is my code and it still saves as temp-plot: `py.plot([ go.Scatter(x=btc_usd_price_kraken.index, y=btc_usd_price_kraken['Weighted Price'])],image_filename='btc.html')` – Dick Thompson Nov 24 '17 at 04:33
  • do I need to have a paid license or something? – Dick Thompson Nov 24 '17 at 04:33
  • If you want a filename for the generated HTML, that's just `filename=` and no, you don't need a paid license for this. – tripleee Nov 24 '17 at 04:35
  • hey how's it going- a similar question regarding HTML. All I'm looking to do is have a way of combining multiple plotly HTMLs into one report (in offline)- whether that be a combined HTML file or even an email. Here's a link to it: https://stackoverflow.com/questions/47480741/is-there-a-way-to-merge-embed-multiple-plotly-html-files-into-one-page-html-file – Dick Thompson Nov 25 '17 at 03:12