MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / __init__

Method __init__

lib/matplotlib/quiver.py:942–996  ·  view source on GitHub ↗

The constructor takes one required argument, an Axes instance, followed by the args and kwargs described by the following pyplot interface documentation: %(barbs_doc)s

(self, ax, *args,
                 pivot='tip', length=7, barbcolor=None, flagcolor=None,
                 sizes=None, fill_empty=False, barb_increments=None,
                 rounding=True, flip_barb=False, **kwargs)

Source from the content-addressed store, hash-verified

940
941 @_docstring.interpd
942 def __init__(self, ax, *args,
943 pivot='tip', length=7, barbcolor=None, flagcolor=None,
944 sizes=None, fill_empty=False, barb_increments=None,
945 rounding=True, flip_barb=False, **kwargs):
946 """
947 The constructor takes one required argument, an Axes
948 instance, followed by the args and kwargs described
949 by the following pyplot interface documentation:
950 %(barbs_doc)s
951 """
952 self.sizes = sizes or dict()
953 self.fill_empty = fill_empty
954 self.barb_increments = barb_increments or dict()
955 self.rounding = rounding
956 self.flip = np.atleast_1d(flip_barb)
957 transform = kwargs.pop('transform', ax.transData)
958 self._pivot = pivot
959 self._length = length
960
961 # Flagcolor and barbcolor provide convenience parameters for
962 # setting the facecolor and edgecolor, respectively, of the barb
963 # polygon. We also work here to make the flag the same color as the
964 # rest of the barb by default
965
966 if None in (barbcolor, flagcolor):
967 kwargs['edgecolors'] = 'face'
968 if flagcolor:
969 kwargs['facecolors'] = flagcolor
970 elif barbcolor:
971 kwargs['facecolors'] = barbcolor
972 else:
973 # Set to facecolor passed in or default to black
974 kwargs.setdefault('facecolors', 'k')
975 else:
976 kwargs['edgecolors'] = barbcolor
977 kwargs['facecolors'] = flagcolor
978
979 # Explicitly set a line width if we're not given one, otherwise
980 # polygons are not outlined and we get no barbs
981 if 'linewidth' not in kwargs and 'lw' not in kwargs:
982 kwargs['linewidth'] = 1
983
984 # Parse out the data arrays from the various configurations supported
985 x, y, u, v, c = _parse_args(*args, caller_name='barbs')
986 self.x = x
987 self.y = y
988 xy = np.column_stack((x, y))
989
990 # Make a collection
991 barb_size = self._length ** 2 / 4 # Empirically determined
992 super().__init__(
993 [], (barb_size,), offsets=xy, offset_transform=transform, **kwargs)
994 self.set_transform(transforms.IdentityTransform())
995
996 self.set_UVC(u, v, c)
997
998 def _find_tails(self, mag, rounding=True, half=5, full=10, flag=50):
999 """

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls 4

set_UVCMethod · 0.95
_parse_argsFunction · 0.85
popMethod · 0.45
set_transformMethod · 0.45

Tested by

no test coverage detected