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 titlesare positioned above the Axes in the center, flush with the leftedge, and flush with the right edge.

Parameters:
labelstr

Text to use for the title

fontdictdict

Discouraged

The use offontdict is discouraged. Parameters should be passed asindividual keyword arguments or using dictionary-unpackingset_title(...,**fontdict).

A dictionary controlling the appearance of the title text,the defaultfontdict 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). IfNone (the default) andrcParams["axes.titley"] (default:None) is also None, y isdetermined 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, seeText for a listof valid text properties.

Notes

Examples usingmatplotlib.pyplot.title#

Interactive functions

Interactive functions

Plotting masked and NaN values

Plotting masked and NaN values

Stairs Demo

Stairs Demo

Step Demo

Step Demo

Findobj Demo

Findobj Demo

Multipage PDF

Multipage PDF

Set and get properties

Set and get properties

Table Demo

Table Demo

Zorder Demo

Zorder Demo

Rotating a 3D plot

Rotating a 3D plot

Text and mathtext using pyplot

Text and mathtext using pyplot

Custom scale

Custom scale

The Sankey class

The Sankey class

Solarized Light stylesheet

Solarized Light stylesheet

Style sheets reference

Style sheets reference

Geographic Projections

Geographic Projections

Multiple subplots

Multiple subplots

Controlling style of text and labels using a dictionary

Controlling style of text and labels using a dictionary

Title positioning

Title positioning

SVG Histogram

SVG Histogram

Pyplot tutorial

Pyplot tutorial

Quick start guide

Quick start guide