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`.
| 298 | |
| 299 | |
| 300 | class 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 |
no outgoing calls
searching dependent graphs…