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

Skip to content

Commit e6a1f00

Browse files
committed
Fix log scaling of polar plots.
svn path=/branches/transforms/; revision=4765
1 parent 7084132 commit e6a1f00

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

lib/matplotlib/axes.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,13 +1287,10 @@ def autoscale_view(self, tight=False, scalex=True, scaley=True):
12871287
return
12881288

12891289
if scalex:
1290-
xl = self.get_xbound()
12911290
XL = self.xaxis.get_major_locator().autoscale()
12921291
self.set_xbound(XL)
12931292
if scaley:
1294-
ylocator = self.yaxis.get_major_locator()
1295-
yl = self.get_ybound()
1296-
YL = ylocator.autoscale()
1293+
YL = self.yaxis.get_major_locator().autoscale()
12971294
self.set_ybound(YL)
12981295

12991296
def update_layout(self, renderer):

lib/matplotlib/projections/polar.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,21 @@ class PolarAffine(Affine2DBase):
7474
The affine part of the polar projection. Scales the output so
7575
that maximum radius rests on the edge of the axes circle.
7676
"""
77-
def __init__(self, limits):
77+
def __init__(self, scale_transform, limits):
7878
"""
7979
limits is the view limit of the data. The only part of
8080
its bounds that is used is ymax (for the radius maximum).
8181
"""
8282
Affine2DBase.__init__(self)
83+
self._scale_transform = scale_transform
8384
self._limits = limits
84-
self.set_children(limits)
85+
self.set_children(scale_transform, limits)
8586
self._mtx = None
8687

8788
def get_matrix(self):
8889
if self._invalid:
89-
ymax = self._limits.ymax
90+
limits_scaled = self._limits.transformed(self._scale_transform)
91+
ymax = limits_scaled.ymax
9092
affine = Affine2D() \
9193
.scale(0.5 / ymax) \
9294
.translate(0.5, 0.5)
@@ -193,7 +195,7 @@ def _set_lim_and_transforms(self):
193195

194196
# An affine transformation on the data, generally to limit the
195197
# range of the axes
196-
self.transProjectionAffine = self.PolarAffine(self.viewLim)
198+
self.transProjectionAffine = self.PolarAffine(self.transScale, self.viewLim)
197199

198200
# The complete data transformation stack -- from data all the
199201
# way to display coordinates
@@ -205,7 +207,7 @@ def _set_lim_and_transforms(self):
205207
# the edge of the axis circle.
206208
self._xaxis_transform = (
207209
self.transProjection +
208-
self.PolarAffine(Bbox.unit()) +
210+
self.PolarAffine(IdentityTransform(), Bbox.unit()) +
209211
self.transAxes)
210212
# The theta labels are moved from radius == 0.0 to radius == 1.1
211213
self._theta_label1_position = Affine2D().translate(0.0, 1.1)

0 commit comments

Comments
 (0)