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

Method _ha_for_angle

lib/matplotlib/text.py:1542–1553  ·  view source on GitHub ↗

Determines horizontal alignment ('ha') for rotation_mode "xtick" based on the angle of rotation in degrees and the vertical alignment.

(self, angle)

Source from the content-addressed store, hash-verified

1540 self.set_fontfamily(fontname)
1541
1542 def _ha_for_angle(self, angle):
1543 """
1544 Determines horizontal alignment ('ha') for rotation_mode "xtick" based on
1545 the angle of rotation in degrees and the vertical alignment.
1546 """
1547 anchor_at_bottom = self.get_verticalalignment() == 'bottom'
1548 if (angle <= 10 or 85 <= angle <= 95 or 350 <= angle or
1549 170 <= angle <= 190 or 265 <= angle <= 275):
1550 return 'center'
1551 elif 10 < angle < 85 or 190 < angle < 265:
1552 return 'left' if anchor_at_bottom else 'right'
1553 return 'right' if anchor_at_bottom else 'left'
1554
1555 def _va_for_angle(self, angle):
1556 """

Callers 2

_get_layoutMethod · 0.95
test_ha_for_angleFunction · 0.95

Calls 1

get_verticalalignmentMethod · 0.95

Tested by 1

test_ha_for_angleFunction · 0.76