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

Method set_UVC

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

Source from the content-addressed store, hash-verified

594 self.stale = False
595
596 def set_UVC(self, U, V, C=None):
597 # We need to ensure we have a copy, not a reference
598 # to an array that might change before draw().
599 U = ma.masked_invalid(U, copy=True).ravel()
600 V = ma.masked_invalid(V, copy=True).ravel()
601 if C is not None:
602 C = ma.masked_invalid(C, copy=True).ravel()
603 for name, var in zip(('U', 'V', 'C'), (U, V, C)):
604 if not (var is None or var.size == self.N or var.size == 1):
605 raise ValueError(f'Argument {name} has a size {var.size}'
606 f' which does not match {self.N},'
607 ' the number of arrow positions')
608
609 mask = ma.mask_or(U.mask, V.mask, copy=False, shrink=True)
610 if C is not None:
611 mask = ma.mask_or(mask, C.mask, copy=False, shrink=True)
612 if mask is ma.nomask:
613 C = C.filled()
614 else:
615 C = ma.array(C, mask=mask, copy=False)
616 self.U = U.filled(1)
617 self.V = V.filled(1)
618 self.Umask = mask
619 if C is not None:
620 self.set_array(C)
621 self.stale = True
622
623 def _dots_per_unit(self, units):
624 """Return a scale factor for converting from units to pixels."""

Callers 1

__init__Method · 0.95

Calls 1

set_arrayMethod · 0.45

Tested by

no test coverage detected