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

Skip to content

Commit fb3181b

Browse files
committed
ENH : add stale flag to Patch
1 parent 15451c7 commit fb3181b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/matplotlib/patches.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ def set_antialiased(self, aa):
257257
if aa is None:
258258
aa = mpl.rcParams['patch.antialiased']
259259
self._antialiased = aa
260+
self.stale = True
260261

261262
def set_aa(self, aa):
262263
"""alias for set_antialiased"""
@@ -272,6 +273,7 @@ def set_edgecolor(self, color):
272273
color = mpl.rcParams['patch.edgecolor']
273274
self._original_edgecolor = color
274275
self._edgecolor = colors.colorConverter.to_rgba(color, self._alpha)
276+
self.stale = True
275277

276278
def set_ec(self, color):
277279
"""alias for set_edgecolor"""
@@ -291,6 +293,7 @@ def set_facecolor(self, color):
291293
if not self._fill:
292294
self._facecolor = list(self._facecolor)
293295
self._facecolor[3] = 0
296+
self.stale = True
294297

295298
def set_fc(self, color):
296299
"""alias for set_facecolor"""
@@ -325,6 +328,7 @@ def set_alpha(self, alpha):
325328
# using self._fill and self._alpha
326329
self.set_facecolor(self._original_facecolor)
327330
self.set_edgecolor(self._original_edgecolor)
331+
self.stale = True
328332

329333
def set_linewidth(self, w):
330334
"""
@@ -334,8 +338,11 @@ def set_linewidth(self, w):
334338
"""
335339
if w is None:
336340
w = mpl.rcParams['patch.linewidth']
341+
337342
self._linewidth = float(w)
338343

344+
self.stale = True
345+
339346
def set_lw(self, lw):
340347
"""alias for set_linewidth"""
341348
return self.set_linewidth(lw)
@@ -375,6 +382,7 @@ def set_linestyle(self, ls):
375382

376383
ls = cbook.ls_mapper.get(ls, ls)
377384
self._linestyle = ls
385+
self.stale = True
378386

379387
def set_ls(self, ls):
380388
"""alias for set_linestyle"""
@@ -388,6 +396,7 @@ def set_fill(self, b):
388396
"""
389397
self._fill = bool(b)
390398
self.set_facecolor(self._original_facecolor)
399+
self.stale = True
391400

392401
def get_fill(self):
393402
'return whether fill is set'
@@ -409,6 +418,7 @@ def set_capstyle(self, s):
409418
raise ValueError('set_capstyle passed "%s";\n' % (s,) +
410419
'valid capstyles are %s' % (self.validCap,))
411420
self._capstyle = s
421+
self.stale = True
412422

413423
def get_capstyle(self):
414424
"Return the current capstyle"
@@ -425,6 +435,7 @@ def set_joinstyle(self, s):
425435
raise ValueError('set_joinstyle passed "%s";\n' % (s,) +
426436
'valid joinstyles are %s' % (self.validJoin,))
427437
self._joinstyle = s
438+
self.stale = True
428439

429440
def get_joinstyle(self):
430441
"Return the current joinstyle"
@@ -457,6 +468,7 @@ def set_hatch(self, hatch):
457468
ACCEPTS: ['/' | '\\\\' | '|' | '-' | '+' | 'x' | 'o' | 'O' | '.' | '*']
458469
"""
459470
self._hatch = hatch
471+
self.stale = True
460472

461473
def get_hatch(self):
462474
'Return the current hatching pattern'
@@ -511,6 +523,7 @@ def draw(self, renderer):
511523

512524
gc.restore()
513525
renderer.close_group('patch')
526+
self.stale = False
514527

515528
def get_path(self):
516529
"""

0 commit comments

Comments
 (0)