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

Skip to content

Commit 5e69629

Browse files
committed
renamed import
renamed imported matplotlib.collections from `collections` -> `mcollections` to try and avoid clashing with `collections` in python core.
1 parent fcaf629 commit 5e69629

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/matplotlib/quiver.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import numpy as np
2121
from numpy import ma
22-
import matplotlib.collections as collections
22+
import matplotlib.collections as mcollections
2323
import matplotlib.transforms as transforms
2424
import matplotlib.text as mtext
2525
import matplotlib.artist as martist
@@ -276,7 +276,7 @@ def _init(self):
276276
self.Q.pivot = _pivot
277277
kw = self.Q.polykw
278278
kw.update(self.kw)
279-
self.vector = collections.PolyCollection(
279+
self.vector = mcollections.PolyCollection(
280280
self.verts,
281281
offsets=[(self.X, self.Y)],
282282
transOffset=self.get_transform(),
@@ -365,7 +365,7 @@ def _parse_args(*args):
365365
return X, Y, U, V, C
366366

367367

368-
class Quiver(collections.PolyCollection):
368+
class Quiver(mcollections.PolyCollection):
369369
"""
370370
Specialized PolyCollection for arrows.
371371
@@ -412,7 +412,7 @@ def __init__(self, ax, *args, **kw):
412412
self.transform = kw.pop('transform', ax.transData)
413413
kw.setdefault('facecolors', self.color)
414414
kw.setdefault('linewidths', (0,))
415-
collections.PolyCollection.__init__(self, [], offsets=self.XY,
415+
mcollections.PolyCollection.__init__(self, [], offsets=self.XY,
416416
transOffset=self.transform,
417417
closed=False,
418418
**kw)
@@ -446,7 +446,7 @@ def remove(self):
446446
self.ax.figure.callbacks.disconnect(self._cid)
447447
self._cid = None
448448
# pass the remove call up the stack
449-
collections.PolyCollection.remove(self)
449+
mcollections.PolyCollection.remove(self)
450450

451451
def _init(self):
452452
"""
@@ -473,7 +473,7 @@ def draw(self, renderer):
473473
verts = self._make_verts(self.U, self.V)
474474
self.set_verts(verts, closed=False)
475475
self._new_UV = False
476-
collections.PolyCollection.draw(self, renderer)
476+
mcollections.PolyCollection.draw(self, renderer)
477477

478478
def set_UVC(self, U, V, C=None):
479479
U = ma.masked_invalid(U, copy=False).ravel()
@@ -806,7 +806,7 @@ def _h_arrows(self, length):
806806
docstring.interpd.update(barbs_doc=_barbs_doc)
807807

808808

809-
class Barbs(collections.PolyCollection):
809+
class Barbs(mcollections.PolyCollection):
810810
'''
811811
Specialized PolyCollection for barbs.
812812
@@ -867,7 +867,7 @@ def __init__(self, ax, *args, **kw):
867867

868868
#Make a collection
869869
barb_size = self._length ** 2 / 4 # Empirically determined
870-
collections.PolyCollection.__init__(self, [], (barb_size,), offsets=xy,
870+
mcollections.PolyCollection.__init__(self, [], (barb_size,), offsets=xy,
871871
transOffset=transform, **kw)
872872
self.set_transform(transforms.IdentityTransform())
873873

@@ -1091,7 +1091,7 @@ def set_offsets(self, xy):
10911091
x, y, u, v = delete_masked_points(self.x.ravel(), self.y.ravel(),
10921092
self.u, self.v)
10931093
xy = np.hstack((x[:, np.newaxis], y[:, np.newaxis]))
1094-
collections.PolyCollection.set_offsets(self, xy)
1095-
set_offsets.__doc__ = collections.PolyCollection.set_offsets.__doc__
1094+
mcollections.PolyCollection.set_offsets(self, xy)
1095+
set_offsets.__doc__ = mcollections.PolyCollection.set_offsets.__doc__
10961096

10971097
barbs_doc = _barbs_doc

0 commit comments

Comments
 (0)