Skip to content

Commit 9e2acb6

Browse files
authored
Merge pull request #8848 from anntzer/graphicscontext-cleanup
Prefer to the GraphicsContext public API when possible.
2 parents d412228 + 34aa69a commit 9e2acb6

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,9 +1120,10 @@ def get_hatch_path(self, density=6.0):
11201120
"""
11211121
Returns a Path for the current hatch.
11221122
"""
1123-
if self._hatch is None:
1123+
hatch = self.get_hatch()
1124+
if hatch is None:
11241125
return None
1125-
return Path.hatch(self._hatch, density)
1126+
return Path.hatch(hatch, density)
11261127

11271128
def get_hatch_color(self):
11281129
"""
@@ -1178,16 +1179,15 @@ def set_sketch_params(self, scale=None, length=None, randomness=None):
11781179
11791180
length : float, optional
11801181
The length of the wiggle along the line, in pixels
1181-
(default 128.0)
1182+
(default 128)
11821183
11831184
randomness : float, optional
11841185
The scale factor by which the length is shrunken or
1185-
expanded (default 16.0)
1186+
expanded (default 16)
11861187
"""
1187-
if scale is None:
1188-
self._sketch = None
1189-
else:
1190-
self._sketch = (scale, length or 128.0, randomness or 16.0)
1188+
self._sketch = (
1189+
None if scale is None
1190+
else (scale, length or 128., randomness or 16.))
11911191

11921192

11931193
class TimerBase(object):

lib/matplotlib/patheffects.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,8 @@ def draw_path(self, renderer, gc, tpath, affine, rgbFace):
386386
affine = self._offset_transform(renderer, affine)
387387
self.patch._path = tpath
388388
self.patch.set_transform(affine)
389-
self.patch.set_clip_box(gc._cliprect)
390-
self.patch.set_clip_path(gc._clippath)
389+
self.patch.set_clip_box(gc.get_clip_rectangle())
390+
clip_path = gc.get_clip_path()
391+
if clip_path:
392+
self.patch.set_clip_path(*clip_path)
391393
self.patch.draw(renderer)

0 commit comments

Comments
 (0)