Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 67a7788

Browse files
committed
Fix some bugs introduced by the contour hatching changes
1 parent e1c50e2 commit 67a7788

5 files changed

Lines changed: 38 additions & 27 deletions

File tree

lib/matplotlib/backends/backend_pdf.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,13 @@ def alphaState(self, alpha):
10581058

10591059
def hatchPattern(self, hatch_style):
10601060
# 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])
1061+
if hatch_style is not None:
1062+
face, edge, hatch = hatch_style
1063+
if face is not None:
1064+
face = tuple(face)
1065+
if edge is not None:
1066+
edge = tuple(edge)
1067+
hatch_style = (face, edge, hatch)
10621068

10631069
pattern = self.hatchPatterns.get(hatch_style, None)
10641070
if pattern is not None:

lib/matplotlib/backends/backend_svg.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,16 @@ def _get_hatch(self, gc, rgbFace):
327327
"""
328328
Create a new hatch pattern
329329
"""
330-
dictkey = (gc.get_hatch(), tuple(rgbFace), tuple(gc.get_rgb()))
330+
if rgbFace is not None:
331+
rgbFace = tuple(rgbFace)
332+
edge = gc.get_rgb()
333+
if edge is not None:
334+
edge = tuple(edge)
335+
dictkey = (gc.get_hatch(), rgbFace, edge)
331336
oid = self._hatchd.get(dictkey)
332337
if oid is None:
333338
oid = self._make_id(u'h', dictkey)
334-
self._hatchd[dictkey] = ((gc.get_hatch_path(), rgbFace, gc.get_rgb()), oid)
339+
self._hatchd[dictkey] = ((gc.get_hatch_path(), rgbFace, edge), oid)
335340
else:
336341
_, oid = oid
337342
return oid
Binary file not shown.
595 Bytes
Loading

lib/matplotlib/tests/baseline_images/test_axes/contour_hatching.svg

Lines changed: 24 additions & 24 deletions
Loading

0 commit comments

Comments
 (0)