Skip to content

Commit 23e335b

Browse files
committed
Merge pull request #891 from mdboom/hatching_crash
Fix a crash when saving to PDF or SVG with contour hatching.
2 parents 8e99098 + d2777c5 commit 23e335b

File tree

6 files changed

+6880
-1
lines changed

6 files changed

+6880
-1
lines changed

lib/matplotlib/backends/backend_pdf.py

+3
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,9 @@ def alphaState(self, alpha):
10571057
return name
10581058

10591059
def hatchPattern(self, hatch_style):
1060+
# The colors may come in as numpy arrays, which aren't hashable
1061+
hatch_style = (tuple(hatch_style[0]), tuple(hatch_style[1]), hatch_style[2])
1062+
10601063
pattern = self.hatchPatterns.get(hatch_style, None)
10611064
if pattern is not None:
10621065
return pattern

lib/matplotlib/backends/backend_svg.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def _get_hatch(self, gc, rgbFace):
327327
"""
328328
Create a new hatch pattern
329329
"""
330-
dictkey = (gc.get_hatch(), rgbFace, gc.get_rgb())
330+
dictkey = (gc.get_hatch(), tuple(rgbFace), tuple(gc.get_rgb()))
331331
oid = self._hatchd.get(dictkey)
332332
if oid is None:
333333
oid = self._make_id(u'h', dictkey)
Binary file not shown.

0 commit comments

Comments
 (0)