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

Skip to content

Commit d6899a7

Browse files
authored
Merge pull request #13424 from anntzer/quivercolor
Deprecate Quiver.color in favor of Quiver.get_facecolor().
2 parents 1d46a93 + 3c0559c commit d6899a7

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Deprecations
2+
````````````
3+
4+
The ``.color`` attribute of `Quiver` objects is deprecated. Instead, use (as
5+
for any `Collection`) the ``get_facecolor`` method. Note that setting to the
6+
``.color`` attribute did not update the quiver artist, whereas calling
7+
``set_facecolor`` does.

lib/matplotlib/quiver.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,6 @@ def __init__(self, ax, *args,
455455
self.scale_units = scale_units
456456
self.angles = angles
457457
self.width = width
458-
self.color = color
459458

460459
if pivot.lower() == 'mid':
461460
pivot = 'middle'
@@ -466,7 +465,7 @@ def __init__(self, ax, *args,
466465
keys=self._PIVOT_VALS, inp=pivot))
467466

468467
self.transform = kw.pop('transform', ax.transData)
469-
kw.setdefault('facecolors', self.color)
468+
kw.setdefault('facecolors', color)
470469
kw.setdefault('linewidths', (0,))
471470
mcollections.PolyCollection.__init__(self, [], offsets=self.XY,
472471
transOffset=self.transform,
@@ -495,6 +494,11 @@ def on_dpi_change(fig):
495494
self._cid = self.ax.figure.callbacks.connect('dpi_changed',
496495
on_dpi_change)
497496

497+
@cbook.deprecated("3.1", alternative="get_facecolor()")
498+
@property
499+
def color(self):
500+
return self.get_facecolor()
501+
498502
def remove(self):
499503
"""
500504
Overload the remove method

0 commit comments

Comments
 (0)