diff --git a/lib/matplotlib/projections/polar.py b/lib/matplotlib/projections/polar.py index 8fe76e9bf59c..6bfe50125994 100644 --- a/lib/matplotlib/projections/polar.py +++ b/lib/matplotlib/projections/polar.py @@ -598,24 +598,13 @@ def update_position(self, loc): angle = (axes.get_rlabel_position() * direction + offset) % 360 - 90 tick_angle = 0 - if angle > 90: - text_angle = angle - 180 - elif angle < -90: - text_angle = angle + 180 - else: - text_angle = angle else: angle = (thetamin * direction + offset) % 360 - 90 if direction > 0: tick_angle = np.deg2rad(angle) else: tick_angle = np.deg2rad(angle + 180) - if angle > 90: - text_angle = angle - 180 - elif angle < -90: - text_angle = angle + 180 - else: - text_angle = angle + text_angle = (angle + 90) % 180 - 90 # between -90 and +90. mode, user_angle = self._labelrotation if mode == 'auto': text_angle += user_angle @@ -646,18 +635,12 @@ def update_position(self, loc): if full: self.label2.set_visible(False) self.tick2line.set_visible(False) + angle = (thetamax * direction + offset) % 360 - 90 + if direction > 0: + tick_angle = np.deg2rad(angle) else: - angle = (thetamax * direction + offset) % 360 - 90 - if direction > 0: - tick_angle = np.deg2rad(angle) - else: - tick_angle = np.deg2rad(angle + 180) - if angle > 90: - text_angle = angle - 180 - elif angle < -90: - text_angle = angle + 180 - else: - text_angle = angle + tick_angle = np.deg2rad(angle + 180) + text_angle = (angle + 90) % 180 - 90 # between -90 and +90. mode, user_angle = self._labelrotation if mode == 'auto': text_angle += user_angle @@ -792,15 +775,8 @@ def get_points(self): # Ensure equal aspect ratio. w, h = self._points[1] - self._points[0] - if h < w: - deltah = (w - h) / 2.0 - deltaw = 0.0 - elif w < h: - deltah = 0.0 - deltaw = (h - w) / 2.0 - else: - deltah = 0.0 - deltaw = 0.0 + deltah = max(w - h, 0) / 2 + deltaw = max(h - w, 0) / 2 self._points += np.array([[-deltaw, -deltah], [deltaw, deltah]]) self._invalid = 0