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

Method _set_text_position

lib/matplotlib/table.py:152–165  ·  view source on GitHub ↗

Set text up so it is drawn in the right place.

(self, renderer)

Source from the content-addressed store, hash-verified

150 self.stale = False
151
152 def _set_text_position(self, renderer):
153 """Set text up so it is drawn in the right place."""
154 bbox = self.get_window_extent(renderer)
155 # center vertically
156 y = bbox.y0 + bbox.height / 2
157 # position horizontally
158 loc = self._text.get_horizontalalignment()
159 if loc == 'center':
160 x = bbox.x0 + bbox.width / 2
161 elif loc == 'left':
162 x = bbox.x0 + bbox.width * self.PAD
163 else: # right.
164 x = bbox.x0 + bbox.width * (1 - self.PAD)
165 self._text.set_position((x, y))
166
167 def get_text_bounds(self, renderer):
168 """

Callers 1

drawMethod · 0.95

Calls 3

get_window_extentMethod · 0.45
set_positionMethod · 0.45

Tested by

no test coverage detected