8000 [ENH]: pre-set file name for GUI save dialog in rcParams · Issue #27774 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
[ENH]: pre-set file name for GUI save dialog in rcParams #27774
Closed
@FilipDominec

Description

@FilipDominec

Problem

While there is an obvious way to specify the output image format as well as directory where GUI suggests to export your interactive plot, like this:

 matplotlib.rcParams["savefig.format"] = "pdf"
 matplotlib.rcParams["savefig.directory"] = ...

there is no easy way to suggest the file base name, and it always defaults to practically useless "Figure_1" or so.

Rationale 1: I often process & plot a lot of scientific datasets with long names that encode a bunch of useful parameters. My scripts would therefore save me significant amount of time if e.g. for "abcd123.dat" they suggested to export into "abcd123.*".

Rationale 2: One old question about this can be found on SO (https://stackoverflow.com/questions/41680007/how-to-change-default-filename-from-matplotlib-navigationtoolbar-in-a-pyqt5-appl) and the proposed solution requires monkey-patching Matplotlib functions - which is ugly, tedious and most importantly, the suggested code did not work anymore.

Proposed solution

Let's allow users to change the filename too, allowing one to simply set:

 matplotlib.rcParams["savefig.basename"] = ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0