Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

AddU,V andC setter toQuiver#26410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ericpre wants to merge7 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromericpre:quiver_setters
Open
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Privatisequiver.Quiver.Umask
  • Loading branch information
@ericpre
ericpre committedMar 23, 2024
commitc8d4924bc4226c85eaa81ac9e087b1369d401d58
13 changes: 7 additions & 6 deletionslib/matplotlib/quiver.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -325,7 +325,7 @@ def _init(self):
self._set_transform()
with cbook._setattr_cm(self.Q, pivot=self.pivot[self.labelpos],
# Hack: save and restore the Umask
Umask=ma.nomask):
_Umask=ma.nomask):
u = self.U * np.cos(np.radians(self.angle))
v = self.U * np.sin(np.radians(self.angle))
self.verts = self.Q._make_verts([[0., 0.]],
Expand DownExpand Up@@ -469,6 +469,7 @@ class Quiver(mcollections.PolyCollection):
"""

_PIVOT_VALS = ('tail', 'middle', 'tip')
Umask = _api.deprecate_privatize_attribute("3.9")

@_docstring.Substitution(_quiver_doc)
def __init__(self, ax, *args,
Expand DownExpand Up@@ -769,7 +770,7 @@ def set_XYUVC(self, X=None, Y=None, U=None, V=None, C=None):
C = ma.array(C, mask=mask, copy=False)
self._U = U.filled(1)
self._V = V.filled(1)
self.Umask = mask
self._Umask = mask
if C is not None:
self.set_array(C)
self._N = N
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is unused now, asN usesget_X.

Expand DownExpand Up@@ -836,8 +837,8 @@ def _make_verts(self, XY, U, V, angles):

if self.scale is None:
sn = max(10, math.sqrt(len(self.get_offsets())))
if self.Umask is not ma.nomask:
amean = a[~self.Umask].mean()
if self._Umask is not ma.nomask:
amean = a[~self._Umask].mean()
else:
amean = a.mean()
# crude auto-scaling
Expand DownExpand Up@@ -867,9 +868,9 @@ def _make_verts(self, XY, U, V, angles):
theta = theta.reshape((-1, 1)) # for broadcasting
xy = (X + Y * 1j) * np.exp(1j * theta) * self.width
XY = np.stack((xy.real, xy.imag), axis=2)
if self.Umask is not ma.nomask:
if self._Umask is not ma.nomask:
XY = ma.array(XY)
XY[self.Umask] = ma.masked
XY[self._Umask] = ma.masked
# This might be handled more efficiently with nans, given
# that nans will end up in the paths anyway.

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp