Set a title for the Axes. Set one of the three available Axes titles. The available titles are positioned above the Axes in the center, flush with the left edge, and flush with the right edge. Parameters ---------- label : str Te
(self, label, fontdict=None, loc=None, pad=None, *, y=None,
**kwargs)
| 136 | return title.get_text() |
| 137 | |
| 138 | def set_title(self, label, fontdict=None, loc=None, pad=None, *, y=None, |
| 139 | **kwargs): |
| 140 | """ |
| 141 | Set a title for the Axes. |
| 142 | |
| 143 | Set one of the three available Axes titles. The available titles |
| 144 | are positioned above the Axes in the center, flush with the left |
| 145 | edge, and flush with the right edge. |
| 146 | |
| 147 | Parameters |
| 148 | ---------- |
| 149 | label : str |
| 150 | Text to use for the title |
| 151 | |
| 152 | fontdict : dict |
| 153 | |
| 154 | .. admonition:: Discouraged |
| 155 | |
| 156 | The use of *fontdict* is discouraged. Parameters should be passed as |
| 157 | individual keyword arguments or using dictionary-unpacking |
| 158 | ``set_title(..., **fontdict)``. |
| 159 | |
| 160 | A dictionary controlling the appearance of the title text, |
| 161 | the default *fontdict* is:: |
| 162 | |
| 163 | {'fontsize': rcParams['axes.titlesize'], |
| 164 | 'fontweight': rcParams['axes.titleweight'], |
| 165 | 'color': rcParams['axes.titlecolor'], |
| 166 | 'verticalalignment': 'baseline', |
| 167 | 'horizontalalignment': loc} |
| 168 | |
| 169 | loc : {'center', 'left', 'right'}, default: :rc:`axes.titlelocation` |
| 170 | Which title to set. |
| 171 | |
| 172 | y : float, default: :rc:`axes.titley` |
| 173 | Vertical Axes location for the title (1.0 is the top). If |
| 174 | None (the default) and :rc:`axes.titley` is also None, y is |
| 175 | determined automatically to avoid decorators on the Axes. |
| 176 | |
| 177 | pad : float, default: :rc:`axes.titlepad` |
| 178 | The offset of the title from the top of the Axes, in points. |
| 179 | |
| 180 | Returns |
| 181 | ------- |
| 182 | `.Text` |
| 183 | The matplotlib text instance representing the title |
| 184 | |
| 185 | Other Parameters |
| 186 | ---------------- |
| 187 | **kwargs : `~matplotlib.text.Text` properties |
| 188 | Other keyword arguments are text properties, see `.Text` for a list |
| 189 | of valid text properties. |
| 190 | """ |
| 191 | loc = mpl._val_or_rc(loc, 'axes.titlelocation').lower() |
| 192 | y = mpl._val_or_rc(y, 'axes.titley') |
| 193 | if y is None: |
| 194 | y = 1.0 |
| 195 | else: |