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 2181f7e

Browse filesBrowse files
author
klaus
committed
optional user defined svg hash salt
1 parent 1fe4df7 commit 2181f7e
Copy full SHA for 2181f7e

File tree

Expand file treeCollapse file tree

3 files changed

+10
-1
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+10
-1
lines changed

‎doc/users/whats_new/rcparams.rst

Copy file name to clipboard
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Added ``svg.hashsalt`` key to rcParams
2+
```````````````````````````````````````
3+
If ``svg.hashsalt`` is ``None`` (which it is by default), the svg backend uses ``uuid4`` to generate the hash salt.
4+
If it is not ``None``, it must be a string that is used as the hash salt instead of ``uuid4``.
5+
This allows for deterministic SVG output.

‎lib/matplotlib/backends/backend_svg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_svg.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,10 @@ def _write_default_style(self):
308308

309309
def _make_id(self, type, content):
310310
content = str(content)
311-
salt = str(uuid.uuid4())
311+
if rcParams['svg.hashsalt'] is None:
312+
salt = str(uuid.uuid4())
313+
else:
314+
salt = rcParams['svg.hashsalt']
312315
if six.PY3:
313316
content = content.encode('utf8')
314317
salt = salt.encode('utf8')

‎lib/matplotlib/rcsetup.py

Copy file name to clipboardExpand all lines: lib/matplotlib/rcsetup.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,7 @@ def validate_hist_bins(s):
11651165
# True to save all characters as paths in the SVG
11661166
'svg.embed_char_paths': [True, deprecate_svg_embed_char_paths],
11671167
'svg.fonttype': ['path', validate_svg_fonttype],
1168+
'svg.hashsalt': [None, validate_any],
11681169

11691170
# set this when you want to generate hardcopy docstring
11701171
'docstring.hardcopy': [False, validate_bool],

0 commit comments

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