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

Class AxisLabel

lib/mpl_toolkits/axisartist/axis_artist.py:300–428  ·  view source on GitHub ↗

Axis label. Derived from `.Text`. The position of the text is updated in the fly, so changing text position has no effect. Otherwise, the properties can be changed as a normal `.Text`. To change the pad between tick labels and axis label, use `set_pad`.

Source from the content-addressed store, hash-verified

298
299
300class AxisLabel(AttributeCopier, LabelBase):
301 """
302 Axis label. Derived from `.Text`. The position of the text is updated
303 in the fly, so changing text position has no effect. Otherwise, the
304 properties can be changed as a normal `.Text`.
305
306 To change the pad between tick labels and axis label, use `set_pad`.
307 """
308
309 def __init__(self, *args, axis_direction="bottom", axis=None, **kwargs):
310 self._axis = axis
311 self._pad = 5
312 self._external_pad = 0 # in pixels
313 LabelBase.__init__(self, *args, **kwargs)
314 self.set_axis_direction(axis_direction)
315
316 def set_pad(self, pad):
317 """
318 Set the internal pad in points.
319
320 The actual pad will be the sum of the internal pad and the
321 external pad (the latter is set automatically by the `.AxisArtist`).
322
323 Parameters
324 ----------
325 pad : float
326 The internal pad in points.
327 """
328 self._pad = pad
329
330 def get_pad(self):
331 """
332 Return the internal pad in points.
333
334 See `.set_pad` for more details.
335 """
336 return self._pad
337
338 def get_ref_artist(self):
339 # docstring inherited
340 return self._axis.label
341
342 def get_text(self):
343 # docstring inherited
344 t = super().get_text()
345 if t == "__from_axes__":
346 return self._axis.label.get_text()
347 return self._text
348
349 _default_alignments = dict(left=("bottom", "center"),
350 right=("top", "center"),
351 bottom=("top", "center"),
352 top=("bottom", "center"))
353
354 def set_default_alignment(self, d):
355 """
356 Set the default alignment. See `set_axis_direction` for details.
357

Callers 2

test_ticklabelsFunction · 0.90
_init_labelMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_ticklabelsFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…