Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2753cf5

Browse files
authored
Merge pull request #14062 from timhoffm/example-quiver-demo
Improve advanced quiver example
2 parents ce211ee + 82c7282 commit 2753cf5

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

examples/images_contours_and_fields/quiver_demo.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
"""
2-
========================================================
3-
Demonstration of advanced quiver and quiverkey functions
4-
========================================================
2+
=======================================
3+
Advanced quiver and quiverkey functions
4+
=======================================
55
66
Demonstrates some more advanced options for `~.axes.Axes.quiver`. For a simple
77
example refer to :doc:`/gallery/images_contours_and_fields/quiver_simple_demo`.
88
9-
Known problem: the plot autoscaling does not take into account the arrows, so
10-
those on the boundaries are often out of the picture. This is *not* an easy
11-
problem to solve in a perfectly general way. The workaround is to manually
12-
expand the Axes objects.
9+
Note: The plot autoscaling does not take into account the arrows, so
10+
those on the boundaries may reach out of the picture. This is not an easy
11+
problem to solve in a perfectly general way. The recommended workaround is to
12+
manually set the Axes limits in such a case.
1313
"""
14+
1415
import matplotlib.pyplot as plt
1516
import numpy as np
1617

@@ -38,14 +39,16 @@
3839

3940
###############################################################################
4041

42+
# sphinx_gallery_thumbnail_number = 3
43+
4144
fig3, ax3 = plt.subplots()
4245
ax3.set_title("pivot='tip'; scales with x view")
4346
M = np.hypot(U, V)
4447
Q = ax3.quiver(X, Y, U, V, M, units='x', pivot='tip', width=0.022,
4548
scale=1 / 0.15)
4649
qk = ax3.quiverkey(Q, 0.9, 0.9, 1, r'$1 \frac{m}{s}$', labelpos='E',
4750
coordinates='figure')
48-
ax3.scatter(X, Y, color='k', s=5)
51+
ax3.scatter(X, Y, color='0.5', s=1)
4952

5053
plt.show()
5154

0 commit comments

Comments
 (0)