Skip to content

Request to support filename config when downloading a plot as a png #2444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
danday74 opened this issue Mar 6, 2018 · 11 comments
Closed

Request to support filename config when downloading a plot as a png #2444

danday74 opened this issue Mar 6, 2018 · 11 comments
Labels
feature something new

Comments

@danday74
Copy link

danday74 commented Mar 6, 2018

The plotly modebar provides a "download plot as a png" button

However, the image downloaded is always called "newplot.png"

Please provide a config point which will allow this default to be overriden - thanks

@alexcjohnson
Copy link
Collaborator

It's completely undocumented, but you can set graphDiv.fn (for filename - leave off the .png extension) and that will get used for the download. You can use that, but we should be able to do better. Perhaps layout.filename or something?

@etpinard
Copy link
Contributor

etpinard commented Mar 6, 2018

layout.filename would help users affected by #1227

@alexcjohnson
Copy link
Collaborator

layout.filename would help users affected by #1227

I doubt it - if we can't set the filename to newplot.png we won't be able to set it to the user's choice of name either.

@danday74
Copy link
Author

danday74 commented Mar 6, 2018

just to confirm that using graphDiv.fn worked - many thanks

        graphDiv.fn = "myfilename";
        Plotly.newPlot(graphDiv, data, layout, options);

@danday74
Copy link
Author

want to close this off?

@etpinard
Copy link
Contributor

I would leave this open. That graphDiv.fn = "" hack is not pretty. We could do better e.g.:

Plotly.newPlot(gd, [], {filename: ""})

// or
Plotly.newPlot(gd, [], {}, {downloadImageFilename: ""})

@alexcjohnson
Copy link
Collaborator

👍 for a config param eg Plotly.newPlot(gd, [], {}, {downloadImageFilename: ""})

@Braintelligence
Copy link

Braintelligence commented Sep 17, 2018

Hello everyone,
so the filename config referenced for Plotly.downloadImage is wrong? It doesn't seem to really work as well...

https://plot.ly/javascript/plotlyjs-function-reference/#plotlydownloadimage

EDIT: I realized this is about the modebar, so sorry for derailing a bit. Still, I can't get downloadImage to respect the filename config. It always pops out as newplot.png...

EDIT2: Nevermind, I had some formatting errors within the downloadImage-Call. Works as expected. Sorry for the trouble 😹

@etpinard
Copy link
Contributor

This one was done in #2607 - released in v1.38.0

@HF-1
Copy link

HF-1 commented Jun 24, 2020

Hi, does anyone know how I can access this feature in Python?

@alexcjohnson
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new
Projects
None yet
Development

No branches or pull requests

5 participants