Skip to content

Name png exports using plot title #5124

Description

@daviddekoning

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:

var filename = opts.filename || gd.fn || 'newplot';
, but the question of escaping / sanitizing the plot title into a filename might need some thought.

Activity

  1. daviddekoning commented on Sep 4, 2020

    @daviddekoning
    Author

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

  2. nicolaskruchten commented on Oct 15, 2020

    @nicolaskruchten
    Contributor

    See also #1227

  3. archmoj commented on Jun 14, 2024

    @archmoj
    Contributor

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

  4. self-assigned this
    on Jul 8, 2024
  5. removed their assignment
    on Aug 2, 2024
  6. added this to the v3.0.0 milestone on Oct 4, 2024
  7. modified the milestones: v3.0.0, v4.0.0 on Nov 7, 2024
  8. alexcjohnson commented on Feb 5, 2026

    @alexcjohnson
    Collaborator

    Adding an option here to explicitly specify a name could be done in a minor release. Changing the default to be the plot title rather than newplot.png I suppose I can see the rationale for putting it in a major, but there's also a good argument that we don't need to wait for a major. For the vast majority of users this would be an improvement, I have to work pretty hard to imagine a scenario where we'd cause anyone problems by changing this filename. You have a script running that's watching for a file called newplot.png to appear in your downloads folder? Unless I'm missing something that seems like an awfully remote possibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions