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

Method set_title

lib/matplotlib/axes/_axes.py:138–217  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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:

Callers 15

set_window_titleMethod · 0.45
test_bold_font_outputFunction · 0.45
_save_figureFunction · 0.45
test_use14corefontsFunction · 0.45
test_savefig_to_stringioFunction · 0.45
test_skew_rectangleFunction · 0.45
test_title_text_locFunction · 0.45

Calls 4

_internal_updateMethod · 0.80
set_textMethod · 0.45
updateMethod · 0.45

Tested by 15

test_bold_font_outputFunction · 0.36
_save_figureFunction · 0.36
test_use14corefontsFunction · 0.36
test_savefig_to_stringioFunction · 0.36
test_skew_rectangleFunction · 0.36
test_title_text_locFunction · 0.36
test_axhspanMethod · 0.36