plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

Name png exports using plot title

Open daviddekoning opened this issue 5 years ago • 3 comments

Currently, when you export a png from a plotly figure, it is saved as newplot.png. Since most plots (the good ones anyways :) ) have titles specified, it would be great if the file could take its name from the figure title. E.G. if there is a figure with the title Daily Active Users, it could be saved as Daily Active Users.png.

This is particularly helpful when working in a jupyter notebook with multiple figures - at the moment, exporting multiple figures just yields a bunch of files called newplot.png, newplot (1).png, etc...

It might be a quick fix here: https://github.com/plotly/plotly.js/blob/b896b19aeb488e19b1cc038e8d9a50c40230c5d9/src/snapshot/download.js#L53, but the question of escaping / sanitizing the plot title into a filename might need some thought.

daviddekoning avatar Sep 04 '20 02:09 daviddekoning

or maybe plotly.express can santize the plot title and set the plot object filename?

daviddekoning avatar Sep 04 '20 02:09 daviddekoning

See also https://github.com/plotly/plotly.js/issues/1227

nicolaskruchten avatar Oct 15 '20 19:10 nicolaskruchten

Perhaps we could add an option to use a desired default name as well as title and subtitle. cc: @emilykl

archmoj avatar Jun 14 '24 20:06 archmoj