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

Skip to content

Commit 2479a4f

Browse files
committed
Fix interpolation in polar plots when theta values go negative. Thanks Jan Gillis for reporting.
svn path=/trunk/matplotlib/; revision=6106
1 parent 8e28c35 commit 2479a4f

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

CHANGELOG

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
2008-09-18 Fix polar interpolation to handle negative values of theta - MGD
2+
13
2008-09-14 Reorganized cbook and mlab methods related to numerical
24
calculations that have little to do with the goals of those two
3-
modules into a separate module numerical_methods.py
5+
modules into a separate module numerical_methods.py
46
Also, added ability to select points and stop point selection
57
with keyboard in ginput and manual contour labeling code.
68
Finally, fixed contour labeling bug. - DMK

lib/matplotlib/projections/polar.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ def transform(self, tr):
5656

5757
def transform_path(self, path):
5858
vertices = path.vertices
59+
t = vertices[:, 0:1]
60+
t[t != (npy.pi * 2.0)] %= (npy.pi * 2.0)
5961
if len(vertices) == 2 and vertices[0, 0] == vertices[1, 0]:
6062
return Path(self.transform(vertices), path.codes)
6163
ipath = path.interpolated(self._resolution)
@@ -168,6 +170,7 @@ def __init__(self, *args, **kwargs):
168170
"""
169171

170172
self._rpad = 0.05
173+
self.resolution = kwargs.pop('resolution', self.RESOLUTION)
171174
Axes.__init__(self, *args, **kwargs)
172175
self.set_aspect('equal', adjustable='box', anchor='C')
173176
self.cla()
@@ -195,7 +198,7 @@ def _set_lim_and_transforms(self):
195198
self.transScale = TransformWrapper(IdentityTransform())
196199

197200
# A (possibly non-linear) projection on the (already scaled) data
198-
self.transProjection = self.PolarTransform(self.RESOLUTION)
201+
self.transProjection = self.PolarTransform(self.resolution)
199202

200203
# An affine transformation on the data, generally to limit the
201204
# range of the axes

0 commit comments

Comments
 (0)