matplotlib.pyplot.title — Matplotlib 3.10.3 documentation (original) (raw)
matplotlib.pyplot.title(label, fontdict=None, loc=None, pad=None, *, y=None, **kwargs)[source]#
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:
labelstr
Text to use for the title
fontdictdict
Discouraged
The use of fontdict is discouraged. Parameters should be passed as individual keyword arguments or using dictionary-unpackingset_title(..., **fontdict)
.
A dictionary controlling the appearance of the title text, the default fontdict is:
{'fontsize': rcParams['axes.titlesize'], 'fontweight': rcParams['axes.titleweight'], 'color': rcParams['axes.titlecolor'], 'verticalalignment': 'baseline', 'horizontalalignment': loc}
loc{'center', 'left', 'right'}, default: [rcParams["axes.titlelocation"]](../../users/explain/customizing.html?highlight=axes.titlelocation#matplotlibrc-sample)
(default: 'center'
)
Which title to set.
yfloat, default: [rcParams["axes.titley"]](../../users/explain/customizing.html?highlight=axes.titley#matplotlibrc-sample)
(default: None
)
Vertical Axes location for the title (1.0 is the top). If None (the default) and [rcParams["axes.titley"]](../../users/explain/customizing.html?highlight=axes.titley#matplotlibrc-sample)
(default: None
) is also None, y is determined automatically to avoid decorators on the Axes.
padfloat, default: [rcParams["axes.titlepad"]](../../users/explain/customizing.html?highlight=axes.titlepad#matplotlibrc-sample)
(default: 6.0
)
The offset of the title from the top of the Axes, in points.
Returns:
The matplotlib text instance representing the title
Other Parameters:
**kwargsText properties
Other keyword arguments are text properties, see Text for a list of valid text properties.
Notes