From 6260c48f20455e50477c777b49f64b69060c755a Mon Sep 17 00:00:00 2001 From: Eric Firing Date: Fri, 23 Jan 2015 11:10:31 -1000 Subject: [PATCH] quiver: always recalculate when drawing; improve docstring; closes #3709, #3817 The reason why the unconditional recalculation now seems to be needed, but was not in v1.4.0, is unknown. --- lib/matplotlib/quiver.py | 19 +++++++++--------- .../test_quiver/quiver_single_test_image.png | Bin 0 -> 4637 bytes lib/matplotlib/tests/test_quiver.py | 9 +++++++++ 3 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 lib/matplotlib/tests/baseline_images/test_quiver/quiver_single_test_image.png 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 0000000000000000000000000000000000000000..efb9689ed394c4648ff229f46e9fa7b5d928c380 GIT binary patch literal 4637 zcmeHLZBSF$89o6N{DQE$O8JsjcbzeA=?bU>2@w&b8A8=%WP=0>TfRb+B?KV^h_Ey; z7SmbAaSaeUWh*6+AOpE(gCtN8boq!FvT+Hqun1{j5kg2vAc;L}JJYQ{I@4e75AMvJ zJNMl8J?Fg7Iq!R(=T`lO7`11o=S~2?p6K%t7Xfhe1Hd8PWjk!)=9lHbhZ8M4`Xd*3 zF0=%c3LBd{j`ks0ppSLiZY&PX8P~ypz~bF?(Wv z`;KAsv5I|F2Y;^FKiKMl?)2T)S(OxV9^Kh_zdhdPOhWHs=eub=M^i-g74079?(Ca; z_~@PA?G5U>Hn~x!xpKMi_^y-IvnJ~o0X1jT2o(iq(F zhwuQfJWvh*^t+$|@QY+Yvkx7d0H}1|GTlUAxLxSHe8=nL)$xIWNI`4sc-7t`5}qUI z@j(zIi$?1htq-|8G&Gbb5B{Umc}{kA_V~mENfiKqm~Au~B?bBvRe#^e=0ke2Ftpl?&6C-RfdXgKO=%Cv0=fb=|sgL4+VCZLwF;5j^9iDfRM^ zSYGQ`#<R)0;YNc z>WLI={VOpNe+)~a73`iss9nCjh=oa>(TmeMKCX^z6lwv;abBaW$q&VECHPMqfw_2< zqgegP@#g6q@eD~3s0@sWx(R^qX@#!yociS^hxn4BRyS)rSCv)k0?7B)UVpB1X_-&;Bm6{i$YRP&GBWdp#~bBP6>62k1} z)NaFQh;c0Hpz>g;wS7iDS{HmNUCvv~_!(F`3vDnm>k6TJ?M0E%zOkfQlD)P+X#0v` z%-XZPeEB%A?}8DK#W12`^E8`2`}OU0i?-plp5D^ZLSJ9iO+ga^G$Cpv^cI|LRUu(o za;aCZ+7~Ds-%!$$bmMB82iORQ163hZN@{8&xzuJ{f7P{=Zw&D7UcDGfrbHm_~?&zAh1{N@^@7q6cr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