Set the label for the y-axis. Parameters ---------- ylabel : str The label text. labelpad : float, default: :rc:`axes.labelpad` Spacing in points from the Axes bounding box including ticks and tick labels. If None, the p
(self, ylabel, fontdict=None, labelpad=None, *,
loc=None, **kwargs)
| 3989 | return label.get_text() |
| 3990 | |
| 3991 | def set_ylabel(self, ylabel, fontdict=None, labelpad=None, *, |
| 3992 | loc=None, **kwargs): |
| 3993 | """ |
| 3994 | Set the label for the y-axis. |
| 3995 | |
| 3996 | Parameters |
| 3997 | ---------- |
| 3998 | ylabel : str |
| 3999 | The label text. |
| 4000 | |
| 4001 | labelpad : float, default: :rc:`axes.labelpad` |
| 4002 | Spacing in points from the Axes bounding box including ticks |
| 4003 | and tick labels. If None, the previous value is left as is. |
| 4004 | |
| 4005 | loc : {'bottom', 'center', 'top'}, default: :rc:`yaxis.labellocation` |
| 4006 | The label position. This is a high-level alternative for passing |
| 4007 | parameters *y* and *horizontalalignment*. |
| 4008 | |
| 4009 | Other Parameters |
| 4010 | ---------------- |
| 4011 | **kwargs : `~matplotlib.text.Text` properties |
| 4012 | `.Text` properties control the appearance of the label. |
| 4013 | |
| 4014 | See Also |
| 4015 | -------- |
| 4016 | text : Documents the properties supported by `.Text`. |
| 4017 | """ |
| 4018 | if labelpad is not None: |
| 4019 | self.yaxis.labelpad = labelpad |
| 4020 | protected_kw = ['y', 'horizontalalignment', 'ha'] |
| 4021 | if {*kwargs} & {*protected_kw}: |
| 4022 | if loc is not None: |
| 4023 | raise TypeError(f"Specifying 'loc' is disallowed when any of " |
| 4024 | f"its corresponding low level keyword " |
| 4025 | f"arguments ({protected_kw}) are also " |
| 4026 | f"supplied") |
| 4027 | |
| 4028 | else: |
| 4029 | loc = mpl._val_or_rc(loc, 'yaxis.labellocation') |
| 4030 | _api.check_in_list(('bottom', 'center', 'top'), loc=loc) |
| 4031 | |
| 4032 | y, ha = { |
| 4033 | 'bottom': (0, 'left'), |
| 4034 | 'center': (0.5, 'center'), |
| 4035 | 'top': (1, 'right') |
| 4036 | }[loc] |
| 4037 | kwargs.update(y=y, horizontalalignment=ha) |
| 4038 | |
| 4039 | return self.yaxis.set_label_text(ylabel, fontdict, **kwargs) |
| 4040 | |
| 4041 | def invert_yaxis(self): |
| 4042 | """ |