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

Method set_UVC

lib/matplotlib/quiver.py:1174–1217  ·  view source on GitHub ↗
(self, U, V, C=None)

Source from the content-addressed store, hash-verified

1172 return barb_list
1173
1174 def set_UVC(self, U, V, C=None):
1175 # We need to ensure we have a copy, not a reference to an array that
1176 # might change before draw().
1177 self.u = ma.masked_invalid(U, copy=True).ravel()
1178 self.v = ma.masked_invalid(V, copy=True).ravel()
1179
1180 # Flip needs to have the same number of entries as everything else.
1181 # Use broadcast_to to avoid a bloated array of identical values.
1182 # (can't rely on actual broadcasting)
1183 if len(self.flip) == 1:
1184 flip = np.broadcast_to(self.flip, self.u.shape)
1185 else:
1186 flip = self.flip
1187
1188 if C is not None:
1189 c = ma.masked_invalid(C, copy=True).ravel()
1190 x, y, u, v, c, flip = cbook.delete_masked_points(
1191 self.x.ravel(), self.y.ravel(), self.u, self.v, c,
1192 flip.ravel())
1193 _check_consistent_shapes(x, y, u, v, c, flip)
1194 else:
1195 x, y, u, v, flip = cbook.delete_masked_points(
1196 self.x.ravel(), self.y.ravel(), self.u, self.v, flip.ravel())
1197 _check_consistent_shapes(x, y, u, v, flip)
1198
1199 magnitude = np.hypot(u, v)
1200 flags, barbs, halves, empty = self._find_tails(
1201 magnitude, self.rounding, **self.barb_increments)
1202
1203 # Get the vertices for each of the barbs
1204
1205 plot_barbs = self._make_barbs(u, v, flags, barbs, halves, empty,
1206 self._length, self._pivot, self.sizes,
1207 self.fill_empty, flip)
1208 self.set_verts(plot_barbs)
1209
1210 # Set the color array
1211 if C is not None:
1212 self.set_array(c)
1213
1214 # Update the offsets in case the masked data changed
1215 xy = np.column_stack((x, y))
1216 self._offsets = xy
1217 self.stale = True
1218
1219 def set_offsets(self, xy):
1220 """

Callers 2

__init__Method · 0.95

Calls 5

_find_tailsMethod · 0.95
_make_barbsMethod · 0.95
_check_consistent_shapesFunction · 0.85
set_vertsMethod · 0.45
set_arrayMethod · 0.45

Tested by 1