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 9529875

Browse filesBrowse files
committed
Restore old polar tick label behaviour for full circles.
1 parent 5f1ecbd commit 9529875
Copy full SHA for 9529875

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+18
-10
lines changed

‎lib/matplotlib/projections/polar.py

Copy file name to clipboardExpand all lines: lib/matplotlib/projections/polar.py
+18-10Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,12 @@ def update_position(self, loc):
322322
trans = self.tick2line._marker._transform
323323
self.tick2line._marker._transform = trans
324324

325-
if self.label1On:
326-
self.label1.set_rotation(np.rad2deg(angle) + self._labelrotation)
327-
if self.label2On:
328-
self.label2.set_rotation(np.rad2deg(angle) + self._labelrotation)
325+
if not _is_full_circle_deg(axes.get_thetamin(), axes.get_thetamax()):
326+
angle = np.rad2deg(angle) + self._labelrotation
327+
if self.label1On:
328+
self.label1.set_rotation(angle)
329+
if self.label2On:
330+
self.label2.set_rotation(angle)
329331

330332
self._update_padding(self._loc * axes.get_theta_direction() +
331333
axes.get_theta_offset())
@@ -479,7 +481,8 @@ class RadialTick(maxis.YTick):
479481
This subclass of `YTick` provides radial ticks with some small modification
480482
to their re-positioning such that ticks are rotated based on axes limits.
481483
This results in ticks that are correctly perpendicular to the spine. Labels
482-
are also rotated to be perpendicular to the spine.
484+
are also rotated to be perpendicular to the spine, but only for wedges, to
485+
preserve backwards compatibility.
483486
"""
484487
def _get_text1(self):
485488
t = maxis.YTick._get_text1(self)
@@ -502,7 +505,7 @@ def update_position(self, loc):
502505
full = _is_full_circle_deg(thetamin, thetamax)
503506

504507
if full:
505-
angle = axes.get_rlabel_position() * direction + offset - 90
508+
angle = 0
506509
tick_angle = np.deg2rad(angle)
507510
else:
508511
angle = thetamin * direction + offset - 90
@@ -825,10 +828,16 @@ def get_xaxis_transform(self, which='grid'):
825828
return self._xaxis_transform
826829

827830
def get_xaxis_text1_transform(self, pad):
828-
return self._xaxis_text_transform, 'bottom', 'center'
831+
if _is_full_circle_rad(*self._realViewLim.intervalx):
832+
return self._xaxis_text_transform, 'center', 'center'
833+
else:
834+
return self._xaxis_text_transform, 'bottom', 'center'
829835

830836
def get_xaxis_text2_transform(self, pad):
831-
return self._xaxis_text_transform, 'top', 'center'
837+
if _is_full_circle_rad(*self._realViewLim.intervalx):
838+
return self._xaxis_text_transform, 'center', 'center'
839+
else:
840+
return self._xaxis_text_transform, 'top', 'center'
832841

833842
def get_yaxis_transform(self, which='grid'):
834843
if which in ('tick1', 'tick2'):
@@ -842,8 +851,7 @@ def get_yaxis_transform(self, which='grid'):
842851
def get_yaxis_text1_transform(self, pad):
843852
thetamin, thetamax = self._realViewLim.intervalx
844853
if _is_full_circle_rad(thetamin, thetamax):
845-
halign = 'left'
846-
pad_shift = _ThetaShift(self, pad, 'rlabel')
854+
return self._yaxis_text_transform, 'bottom', 'left'
847855
elif self.get_theta_direction() > 0:
848856
halign = 'left'
849857
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.