Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
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
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
b26858510adf0b92848b2e5b42b1c8d4924aba8d9b9b5bc95File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
set_offsets toquiver and make the attribute (N andXY) p……roperties to avoid inconsistent state of `quiver`
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -447,7 +447,7 @@ class Quiver(mcollections.PolyCollection): | ||
| The API methods are set_UVC(), set_U(), set_V() and set_C(), which | ||
| can be used to change the size, orientation, and color of the | ||
| arrows; their locations are fixed when the class is | ||
| instantiated. Possiblythese methods will be useful | ||
| in animations. | ||
| Much of the work in this class is done in the draw() | ||
| @@ -475,8 +475,6 @@ def __init__(self, ax, *args, | ||
| X, Y, U, V, C = _parse_args(*args, caller_name='quiver') | ||
| self.X = X | ||
| self.Y = Y | ||
| self.scale = scale | ||
| self.headwidth = headwidth | ||
| self.headlength = float(headlength) | ||
| @@ -523,6 +521,14 @@ def _init(self): | ||
| self._dpi_at_last_init = self.axes.figure.dpi | ||
| @property | ||
| def N(self): | ||
| return len(self.X) | ||
| @property | ||
| def XY(self): | ||
| return np.column_stack((self.X, self.Y)) | ||
| ||
| def get_datalim(self, transData): | ||
| trans = self.get_transform() | ||
| offset_trf = self.get_offset_transform() | ||
| @@ -588,6 +594,7 @@ def set_UVC(self, U, V, C=None): | ||
| The size must the same as the existing U, V or be one. | ||
| C : array-like or None, optional | ||
| The arrow colors. The default is None. | ||
| The size must the same as the existing U, V or be one. | ||
| """ | ||
| if U is None: | ||
| U = self.U | ||
| @@ -619,6 +626,19 @@ def set_UVC(self, U, V, C=None): | ||
| self.set_array(C) | ||
| self.stale = True | ||
| def set_offsets(self, xy): | ||
| ||
| """ | ||
| Set the offsets for the arrows. This saves the offsets passed | ||
| in and masks them as appropriate for the existing X/Y data. | ||
| Parameters | ||
| ---------- | ||
| xy : sequence of pairs of floats | ||
| """ | ||
| self.X, self.Y = xy[:, 0], xy[:, 1] | ||
| super().set_offsets(xy) | ||
| self.stale = True | ||
| def _dots_per_unit(self, units): | ||
| """Return a scale factor for converting from units to pixels.""" | ||
| bb = self.axes.bbox | ||