diff --git a/lib/matplotlib/quiver.py b/lib/matplotlib/quiver.py index 6d33e55baf54..3a2fdcc2fdfc 100644 --- a/lib/matplotlib/quiver.py +++ b/lib/matplotlib/quiver.py @@ -87,12 +87,15 @@ *angles*: [ 'uv' | 'xy' | array ] - With the default 'uv', the arrow aspect ratio is 1, so that - if *U*==*V* the angle of the arrow on the plot is 45 degrees - CCW from the *x*-axis. + With the default 'uv', the arrow axis aspect ratio is 1, so that + if *U*==*V* the orientation of the arrow on the plot is 45 degrees + CCW from the horizontal axis (positive to the right). With 'xy', the arrow points from (x,y) to (x+u, y+v). + Use this for plotting a gradient field, for example. Alternatively, arbitrary angles may be specified as an array - of values in degrees, CCW from the *x*-axis. + of values in degrees, CCW from the horizontal axis. + Note: inverting a data axis will correspondingly invert the + arrows *only* with `angles='xy'`. *scale*: [ *None* | float ] Data units per arrow length unit, e.g., m/s per plot width; a smaller @@ -520,11 +523,9 @@ def get_datalim(self, transData): @allow_rasterization def draw(self, renderer): self._init() - if (self._new_UV or self.angles == 'xy' - or self.scale_units in ['x', 'y', 'xy']): - verts = self._make_verts(self.U, self.V) - self.set_verts(verts, closed=False) - self._new_UV = False + verts = self._make_verts(self.U, self.V) + self.set_verts(verts, closed=False) + self._new_UV = False mcollections.PolyCollection.draw(self, renderer) def set_UVC(self, U, V, C=None): diff --git a/lib/matplotlib/tests/baseline_images/test_quiver/quiver_single_test_image.png b/lib/matplotlib/tests/baseline_images/test_quiver/quiver_single_test_image.png new file mode 100644 index 000000000000..efb9689ed394 Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_quiver/quiver_single_test_image.png differ diff --git a/lib/matplotlib/tests/test_quiver.py b/lib/matplotlib/tests/test_quiver.py index ac4bccf98dc3..8d47753c30e4 100644 --- a/lib/matplotlib/tests/test_quiver.py +++ b/lib/matplotlib/tests/test_quiver.py @@ -74,6 +74,15 @@ def test_quiver_with_key(): 'size': 'large'}) +@image_comparison(baseline_images=['quiver_single_test_image'], + extensions=['png'], remove_text=True) +def test_quiver_single(): + fig, ax = plt.subplots() + ax.margins(0.1) + + ax.quiver([1], [1], [2], [2]) + + if __name__ == '__main__': import nose nose.runmodule()