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

Skip to content

Commit b280f7d

Browse files
committed
Merge pull request #4034 from efiring/quiverdraw
BUG : fixes for quiver - always recalculate verts - improve docstring; closes #3709 closes #3817
2 parents 41efb46 + 6260c48 commit b280f7d

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

lib/matplotlib/quiver.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,15 @@
8787
8888
8989
*angles*: [ 'uv' | 'xy' | array ]
90-
With the default 'uv', the arrow aspect ratio is 1, so that
91-
if *U*==*V* the angle of the arrow on the plot is 45 degrees
92-
CCW from the *x*-axis.
90+
With the default 'uv', the arrow axis aspect ratio is 1, so that
91+
if *U*==*V* the orientation of the arrow on the plot is 45 degrees
92+
CCW from the horizontal axis (positive to the right).
9393
With 'xy', the arrow points from (x,y) to (x+u, y+v).
94+
Use this for plotting a gradient field, for example.
9495
Alternatively, arbitrary angles may be specified as an array
95-
of values in degrees, CCW from the *x*-axis.
96+
of values in degrees, CCW from the horizontal axis.
97+
Note: inverting a data axis will correspondingly invert the
98+
arrows *only* with `angles='xy'`.
9699
97100
*scale*: [ *None* | float ]
98101
Data units per arrow length unit, e.g., m/s per plot width; a smaller
@@ -520,11 +523,9 @@ def get_datalim(self, transData):
520523
@allow_rasterization
521524
def draw(self, renderer):
522525
self._init()
523-
if (self._new_UV or self.angles == 'xy'
524-
or self.scale_units in ['x', 'y', 'xy']):
525-
verts = self._make_verts(self.U, self.V)
526-
self.set_verts(verts, closed=False)
527-
self._new_UV = False
526+
verts = self._make_verts(self.U, self.V)
527+
self.set_verts(verts, closed=False)
528+
self._new_UV = False
528529
mcollections.PolyCollection.draw(self, renderer)
529530

530531
def set_UVC(self, U, V, C=None):

lib/matplotlib/tests/test_quiver.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ def test_quiver_with_key():
7474
'size': 'large'})
7575

7676

77+
@image_comparison(baseline_images=['quiver_single_test_image'],
78+
extensions=['png'], remove_text=True)
79+
def test_quiver_single():
80+
fig, ax = plt.subplots()
81+
ax.margins(0.1)
82+
83+
ax.quiver([1], [1], [2], [2])
84+
85+
7786
if __name__ == '__main__':
7887
import nose
7988
nose.runmodule()

0 commit comments

Comments
 (0)