matplotlib.pyplot.title#

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-unpacking set_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"] (default: 'center')

Which title to set.

yfloat, default: rcParams["axes.titley"] (default: None)

Vertical Axes location for the title (1.0 is the top). If None (the default) and rcParams["axes.titley"] (default: None) is also None, y is determined automatically to avoid decorators on the Axes.

padfloat, default: rcParams["axes.titlepad"] (default: 6.0)

The offset of the title from the top of the Axes, in points.

Returns:
Text

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

Note

This is the pyplot wrapper for axes.Axes.set_title.

Examples using matplotlib.pyplot.title#

Image

Interactive functions

Interactive functions
Image

Plotting masked and NaN values

Plotting masked and NaN values
Image

Stairs Demo

Stairs Demo
Image

Step Demo

Step Demo
Image

Findobj Demo

Findobj Demo
Image

Multipage PDF

Multipage PDF
Image

Set and get properties

Set and get properties
Image

Table Demo

Table Demo
Image

Zorder Demo

Zorder Demo
Image

Rotating a 3D plot

Rotating a 3D plot
Image

Text and mathtext using pyplot

Text and mathtext using pyplot
Image

Custom scale

Custom scale
Image

The Sankey class

The Sankey class
Image

Solarized Light stylesheet

Solarized Light stylesheet
Image

Style sheets reference

Style sheets reference
Image

Geographic Projections

Geographic Projections
Image

Multiple subplots

Multiple subplots
Image

Controlling style of text and labels using a dictionary

Controlling style of text and labels using a dictionary
Image

Title positioning

Title positioning
Image

SVG Histogram

SVG Histogram
Image

Pyplot tutorial

Pyplot tutorial
Image

Quick start guide

Quick start guide