Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 12b0120

Browse filesBrowse files
committed
Preserve the default values of the metadata. Allow user to update if necessary
1 parent 0f006e3 commit 12b0120
Copy full SHA for 12b0120

File tree

Expand file treeCollapse file tree

2 files changed

+16
-15
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+16
-15
lines changed

‎lib/matplotlib/backends/backend_agg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_agg.py
+9-7Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -554,14 +554,16 @@ def print_png(self, filename_or_obj, *args, **kwargs):
554554
else:
555555
close = False
556556

557-
metadata = kwargs.pop("metadata", None)
558-
if metadata is None:
559-
version_str = 'matplotlib version ' + __version__ + \
560-
', http://matplotlib.org/'
561-
metadata = {six.b('Software'): six.b(version_str)}
557+
version_str = 'matplotlib version ' + __version__ + \
558+
', http://matplotlib.org/'
559+
metadata = {six.b('Software'): six.b(version_str)}
560+
user_metadata = kwargs.pop("metadata", None)
561+
if user_metadata is not None:
562+
metadata.update(user_metadata)
563+
562564
try:
563-
_png.write_png(renderer._renderer, filename_or_obj, self.figure.dpi,
564-
metadata=metadata)
565+
_png.write_png(renderer._renderer, filename_or_obj,
566+
self.figure.dpi, metadata=metadata)
565567
finally:
566568
if close:
567569
filename_or_obj.close()

‎lib/matplotlib/backends/backend_pdf.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_pdf.py
+7-8Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -482,15 +482,14 @@ def __init__(self, filename, metadata=None):
482482
else:
483483
source_date = datetime.today()
484484

485+
self.infoDict = {
486+
'Creator': 'matplotlib ' + __version__ +
487+
', http://matplotlib.org',
488+
'Producer': 'matplotlib pdf backend%s' % revision,
489+
'CreationDate': source_date
490+
}
485491
if metadata is not None:
486-
self.infoDict = metadata
487-
else:
488-
self.infoDict = {
489-
'Creator': 'matplotlib ' + __version__ +
490-
', http://matplotlib.org',
491-
'Producer': 'matplotlib pdf backend%s' % revision,
492-
'CreationDate': source_date
493-
}
492+
self.infoDict.update(metadata)
494493

495494
self.fontNames = {} # maps filenames to internal font names
496495
self.nextFont = 1 # next free internal font name

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.