Skip to content

Commit ef4615e

Browse files
committed
Add release note
1 parent 61bd7d2 commit ef4615e

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
Add ``U``, ``V`` and ``C`` setter to ``Quiver``
2+
-----------------------------------------------
3+
4+
The ``U``, ``V`` and ``C`` values of the `~matplotlib.quiver.Quiver`
5+
can now be changed after the collection has been created.
6+
7+
.. plot::
8+
:include-source: true
9+
10+
import matplotlib.pyplot as plt
11+
from matplotlib.quiver import Quiver
12+
import numpy as np
13+
14+
fig, ax = plt.subplots()
15+
X = np.arange(-10, 10, 1)
16+
Y = np.arange(-10, 10, 1)
17+
U, V = np.meshgrid(X, Y)
18+
C = np.hypot(U, V)
19+
qc = ax.quiver(X, Y, U, V, C)
20+
21+
qc.set_U(U/5)
22+
23+
24+
The number of arrows can also be changed.
25+
26+
.. plot::
27+
:include-source: true
28+
29+
import matplotlib.pyplot as plt
30+
from matplotlib.quiver import Quiver
31+
import numpy as np
32+
33+
fig, ax = plt.subplots()
34+
X = np.arange(-10, 10, 1)
35+
Y = np.arange(-10, 10, 1)
36+
U, V = np.meshgrid(X, Y)
37+
C = np.hypot(U, V)
38+
qc = ax.quiver(X, Y, U, V, C)
39+
40+
# Get new X, Y, U, V, C
41+
X = np.arange(-10, 10, 2)
42+
Y = np.arange(-10, 10, 2)
43+
U, V = np.meshgrid(X, Y)
44+
C = np.hypot(U, V)
45+
X, Y = np.meshgrid(X, Y)
46+
XY = np.column_stack((X.ravel(), Y.ravel()))
47+
48+
# Set new values
49+
qc.set_offsets(XY)
50+
qc.set_UVC(U, V, C)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy