MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / update_position

Method update_position

lib/matplotlib/projections/polar.py:591–669  ·  view source on GitHub ↗
(self, loc)

Source from the content-addressed store, hash-verified

589 return 'center', 'bottom'
590
591 def update_position(self, loc):
592 super().update_position(loc)
593 axes = self.axes
594 thetamin = axes.get_thetamin()
595 thetamax = axes.get_thetamax()
596 direction = axes.get_theta_direction()
597 offset_rad = axes.get_theta_offset()
598 offset = np.rad2deg(offset_rad)
599 full = _is_full_circle_deg(thetamin, thetamax)
600
601 if full:
602 angle = (axes.get_rlabel_position() * direction +
603 offset) % 360 - 90
604 tick_angle = 0
605 else:
606 angle = (thetamin * direction + offset) % 360 - 90
607 if direction > 0:
608 tick_angle = np.deg2rad(angle)
609 else:
610 tick_angle = np.deg2rad(angle + 180)
611 text_angle = (angle + 90) % 180 - 90 # between -90 and +90.
612 mode, user_angle = self._labelrotation
613 if mode == 'auto':
614 text_angle += user_angle
615 else:
616 text_angle = user_angle
617
618 if full:
619 ha = self.label1.get_horizontalalignment()
620 va = self.label1.get_verticalalignment()
621 else:
622 ha, va = self._determine_anchor(mode, angle, direction > 0)
623 self.label1.set_horizontalalignment(ha)
624 self.label1.set_verticalalignment(va)
625 self.label1.set_rotation(text_angle)
626
627 marker = self.tick1line.get_marker()
628 if marker == mmarkers.TICKLEFT:
629 trans = mtransforms.Affine2D().rotate(tick_angle)
630 elif marker == '_':
631 trans = mtransforms.Affine2D().rotate(tick_angle + np.pi / 2)
632 elif marker == mmarkers.TICKRIGHT:
633 trans = mtransforms.Affine2D().scale(-1, 1).rotate(tick_angle)
634 else:
635 # Don't modify custom tick line markers.
636 trans = self.tick1line._marker._transform
637 self.tick1line._marker._transform = trans
638
639 if full:
640 self.label2.set_visible(False)
641 self.tick2line.set_visible(False)
642 angle = (thetamax * direction + offset) % 360 - 90
643 if direction > 0:
644 tick_angle = np.deg2rad(angle)
645 else:
646 tick_angle = np.deg2rad(angle + 180)
647 text_angle = (angle + 90) % 180 - 90 # between -90 and +90.
648 mode, user_angle = self._labelrotation

Callers

nothing calls this directly

Calls 15

_determine_anchorMethod · 0.95
_is_full_circle_degFunction · 0.85
get_thetaminMethod · 0.80
get_thetamaxMethod · 0.80
get_theta_directionMethod · 0.80
get_theta_offsetMethod · 0.80
get_rlabel_positionMethod · 0.80
get_verticalalignmentMethod · 0.80
set_verticalalignmentMethod · 0.80
set_rotationMethod · 0.80

Tested by

no test coverage detected