Skip to content

Commit 8ea7900

Browse files
committed
ENH : add stale flag to Patch
1 parent 8acd1bb commit 8ea7900

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)
@@ -349,6 +356,7 @@ def set_linestyle(self, ls):
349356
if ls is None:
350357
ls = "solid"
351358
self._linestyle = ls
359+
self.stale = True
352360

353361
def set_ls(self, ls):
354362
"""alias for set_linestyle"""
@@ -362,6 +370,7 @@ def set_fill(self, b):
362370
"""
363371
self._fill = bool(b)
364372
self.set_facecolor(self._original_facecolor)
373+
self.stale = True
365374

366375
def get_fill(self):
367376
'return whether fill is set'
@@ -383,6 +392,7 @@ def set_capstyle(self, s):
383392
raise ValueError('set_capstyle passed "%s";\n' % (s,) +
384393
'valid capstyles are %s' % (self.validCap,))
385394
self._capstyle = s
395+
self.stale = True
386396

387397
def get_capstyle(self):
388398
"Return the current capstyle"
@@ -399,6 +409,7 @@ def set_joinstyle(self, s):
399409
raise ValueError('set_joinstyle passed "%s";\n' % (s,) +
400410
'valid joinstyles are %s' % (self.validJoin,))
401411
self._joinstyle = s
412+
self.stale = True
402413

403414
def get_joinstyle(self):
404415
"Return the current joinstyle"
@@ -431,6 +442,7 @@ def set_hatch(self, hatch):
431442
ACCEPTS: ['/' | '\\\\' | '|' | '-' | '+' | 'x' | 'o' | 'O' | '.' | '*']
432443
"""
433444
self._hatch = hatch
445+
self.stale = True
434446

435447
def get_hatch(self):
436448
'Return the current hatching pattern'
@@ -485,6 +497,7 @@ def draw(self, renderer):
485497

486498
gc.restore()
487499
renderer.close_group('patch')
500+
self.stale = False
488501

489502
def get_path(self):
490503
"""

0 commit comments

Comments
 (0)