-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add support for png_text metadata, allow to customize metadata for other backends. #7349
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
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
bc6e367
Allow to store metadata in png files
Xarthisius 5200aff
Ensure that metadata pointer is initially set to NULL
Xarthisius 5a5bd96
Allow to pass custom infoDict to images created with pdf backend
Xarthisius d8cac23
Allow to pass custom metadata to png images created with agg backend
Xarthisius 8305868
Allow to pass custom Creator to images created with ps backend
Xarthisius 0d814e0
'Software' starts with capital letter as per PNG specification
Xarthisius 112e38a
fix pep8 issue
Xarthisius 0f006e3
Drop debug statements
Xarthisius 12b0120
Preserve the default values of the metadata. Allow user to update if …
Xarthisius d75b068
Revert accidental changes and fix indentation
Xarthisius 92bccd2
Handle unicode/bytes directly in the C extension
Xarthisius e174284
Use 'latin_1' encoding instead of ascii
Xarthisius af4c1d1
Fix numpydoc format issues
Xarthisius 98b5587
Add example info dictionary
Xarthisius a2d2c37
Add a description for the 'metadata' keyword to the docstring
Xarthisius 06ad9fb
Explicitly define 'metadata' kwarg in '_print_figure'
Xarthisius 6916e77
Define 'metadata' as kwarg in _print_figure_tex for consistency
Xarthisius 8bb0ae3
Use default value for invalid key instead of NULL
Xarthisius 66f6e2d
Use OrderedDict for metadata
Xarthisius 8897f0f
Add 'what is new' entry for metadata kwarg in matplotlib.pyplot.savefig
Xarthisius 935e02f
Fix merge
Xarthisius File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Metadata savefig kwarg | ||
---------------------- | ||
|
||
:func:`~matplotlib.pyplot.savefig` now accepts `metadata` as a keyword argument. | ||
It can be used to store key/value pairs in the image metadata. | ||
|
||
Supported formats and backends | ||
`````````````````````````````` | ||
* 'png' with Agg backend | ||
* 'pdf' with PDF backend (see | ||
:func:`~matplotlib.backends.backend_pdf.PdfFile.writeInfoDict` for a list of | ||
supported keywords) | ||
* 'eps' and 'ps' with PS backend (only 'Creator' key is accepted) | ||
|
||
Example | ||
``````` | ||
:: | ||
|
||
plt.savefig('test.png', metadata={'Software': 'My awesome software'}) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't find this documentation particularly useful. You could you add at least some examples of metadata ?
Also, numpydoc format requires a space before the column :
metadata : dictionary, …
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original parameters all don't have a space before the colon, and rendered fine, so I don't think that's a requirement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is. The current documentation is not rendered properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, I missed that the bolding is wrong.