Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 47f2399

Browse filesBrowse files
committed
Restore old polar tick label behaviour for full circles.
1 parent 31681b3 commit 47f2399
Copy full SHA for 47f2399

File tree

Expand file treeCollapse file tree

1 file changed

+19
-10
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+19
-10
lines changed

‎lib/matplotlib/projections/polar.py

Copy file name to clipboardExpand all lines: lib/matplotlib/projections/polar.py
+19-10Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,13 @@ def update_position(self, loc):
309309
trans = self.tick2line._marker._transform
310310
self.tick2line._marker._transform = trans
311311

312-
if self.label1On:
313-
self.label1.set_rotation(np.rad2deg(angle) + self._labelrotation)
314-
if self.label2On:
315-
self.label2.set_rotation(np.rad2deg(angle) + self._labelrotation)
312+
thetamin = self.axes.get_thetamin()
313+
thetamax = self.axes.get_thetamax()
314+
if not _is_full_circle_deg(thetamin, thetamax):
315+
if self.label1On:
316+
self.label1.set_rotation(np.rad2deg(angle) + self._labelrotation)
317+
if self.label2On:
318+
self.label2.set_rotation(np.rad2deg(angle) + self._labelrotation)
316319

317320
@martist.allow_rasterization
318321
def draw(self, renderer):
@@ -468,7 +471,8 @@ class RadialTick(maxis.YTick):
468471
This subclass of `YTick` provides radial ticks with some small modification
469472
to their re-positioning such that ticks are rotated based on axes limits.
470473
This results in ticks that are correctly perpendicular to the spine. Labels
471-
are also rotated to be perpendicular to the spine.
474+
are also rotated to be perpendicular to the spine, but only for wedges, to
475+
preserve backwards compatibility.
472476
"""
473477
def _get_text1(self):
474478
t = maxis.YTick._get_text1(self)
@@ -491,7 +495,7 @@ def update_position(self, loc):
491495
full = _is_full_circle_deg(thetamin, thetamax)
492496

493497
if full:
494-
angle = axes.get_rlabel_position() * direction + offset - 90
498+
angle = 0
495499
tick_angle = np.deg2rad(angle)
496500
else:
497501
angle = thetamin * direction + offset - 90
@@ -798,10 +802,16 @@ def get_xaxis_transform(self, which='grid'):
798802
return self._xaxis_transform
799803

800804
def get_xaxis_text1_transform(self, pad):
801-
return self._xaxis_text_transform, 'bottom', 'center'
805+
if _is_full_circle_rad(*self._realViewLim.intervalx):
806+
return self._xaxis_text_transform, 'center', 'center'
807+
else:
808+
return self._xaxis_text_transform, 'bottom', 'center'
802809

803810
def get_xaxis_text2_transform(self, pad):
804-
return self._xaxis_text_transform, 'top', 'center'
811+
if _is_full_circle_rad(*self._realViewLim.intervalx):
812+
return self._xaxis_text_transform, 'center', 'center'
813+
else:
814+
return self._xaxis_text_transform, 'top', 'center'
805815

806816
def get_yaxis_transform(self, which='grid'):
807817
if which in ('tick1', 'tick2'):
@@ -815,8 +825,7 @@ def get_yaxis_transform(self, which='grid'):
815825
def get_yaxis_text1_transform(self, pad):
816826
thetamin, thetamax = self._realViewLim.intervalx
817827
if _is_full_circle_rad(thetamin, thetamax):
818-
halign = 'left'
819-
pad_shift = _ThetaShift(self, pad, 'rlabel')
828+
return self._yaxis_text_transform, 'bottom', 'left'
820829
elif self.get_theta_direction() > 0:
821830
halign = 'left'
822831
pad_shift = _ThetaShift(self, pad, 'min')

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.