matplotlib.axes.Axes.set_title#

Axes.set_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.

Examples using matplotlib.axes.Axes.set_title#

pyplot animation

pyplot animation

Make room for ylabel using axes_grid

Make room for ylabel using axes_grid

Axis Direction

Axis Direction

Colors in the default property cycle

Colors in the default property cycle

Color Demo

Color Demo

Named color sequences

Named color sequences

Create a colormap from a list of colors

Create a colormap from a list of colors

Ways to set a color's alpha value

Ways to set a color's alpha value

Cross-hair cursor

Cross-hair cursor

Data browser

Data browser

Keypress event

Keypress event

Legend picking

Legend picking

Looking glass

Looking glass

Path editor

Path editor

Pick event demo

Pick event demo

Pick event demo 2

Pick event demo 2

Polygon editor

Polygon editor

Trifinder Event Demo

Trifinder Event Demo

Viewlims

Viewlims

Interactive adjustment of colormap range

Interactive adjustment of colormap range

Contour corner mask

Contour corner mask

Contour Demo

Contour Demo

Contour Label Demo

Contour Label Demo

Contourf demo

Contourf demo

Annotated heatmap

Annotated heatmap

Image resampling

Image resampling

Many ways to plot images

Many ways to plot images

Image with masked values

Image with masked values

Image nonuniform

Image nonuniform

Interpolations for imshow

Interpolations for imshow

Contour plot of irregularly spaced data

Contour plot of irregularly spaced data

pcolor images

pcolor images

pcolormesh grids and shading

pcolormesh grids and shading

pcolormesh

pcolormesh

Advanced quiver and quiverkey functions

Advanced quiver and quiverkey functions

Tricontour Demo

Tricontour Demo

Tricontour Smooth Delaunay

Tricontour Smooth Delaunay

Tricontour Smooth User

Tricontour Smooth User

Trigradient Demo

Trigradient Demo

Tripcolor Demo

Tripcolor Demo

Triplot Demo

Triplot Demo

Bar chart with individual bar colors

Bar chart with individual bar colors

Bar chart with labels

Bar chart with labels

Stacked bar chart

Stacked bar chart

Grouped bar chart with labels

Grouped bar chart with labels

Horizontal bar chart

Horizontal bar chart

Broken horizontal bars

Broken horizontal bars

Errorbar subsampling

Errorbar subsampling

EventCollection Demo

EventCollection Demo

fill_between with transparency

fill_between with transparency

Fill the area between two lines

Fill the area between two lines

Fill the area between two vertical lines

Fill the area between two vertical lines

Hat graph

Hat graph

Markevery Demo

Markevery Demo

Multicolored lines

Multicolored lines

Power spectral density (PSD)

Power spectral density (PSD)

Scatter Demo2

Scatter Demo2

Stackplots and streamgraphs

Stackplots and streamgraphs

hlines and vlines

hlines and vlines

Cross- and auto-correlation

Cross- and auto-correlation

Packed-bubble chart

Packed-bubble chart

Rasterization for vector graphics

Rasterization for vector graphics

Zorder Demo

Zorder Demo

Demo of 3D bar charts

Demo of 3D bar charts

Lorenz attractor

Lorenz attractor

3D wireframe plots in one direction

3D wireframe plots in one direction

Bar of pie

Bar of pie

A pie and a donut with labels

A pie and a donut with labels

Polar plot

Polar plot

Error bar rendering on polar axis

Error bar rendering on polar axis

Asinh scale

Asinh scale

Loglog aspect

Loglog aspect

Log scale

Log scale

Exploring normalizations

Exploring normalizations

Symlog scale

Symlog scale

Line, Poly and RegularPoly Collection with autoscaling

Line, Poly and RegularPoly Collection with autoscaling

Compound path

Compound path

Mmh Donuts!!!

Mmh Donuts!!!

Drawing fancy boxes

Drawing fancy boxes

Plot multiple lines using a LineCollection

Plot multiple lines using a LineCollection

Bezier curve

Bezier curve

Anatomy of a figure

Anatomy of a figure

XKCD

XKCD

Radar chart (aka spider or star chart)

Radar chart (aka spider or star chart)

Topographic hillshading

Topographic hillshading

Spine placement

Spine placement

Spines

Spines

Plot a confidence ellipse of a two-dimensional dataset

Plot a confidence ellipse of a two-dimensional dataset

Violin plot customization

Violin plot customization

Different ways of specifying error bars

Different ways of specifying error bars

Including upper and lower limits in error bars

Including upper and lower limits in error bars

Hexagonal binned plot

Hexagonal binned plot

The histogram (hist) function with multiple data sets

The histogram (hist) function with multiple data sets

Histogram bins, density, and weight

Histogram bins, density, and weight

Bayesian Methods for Hackers style sheet

Bayesian Methods for Hackers style sheet

Dark background style sheet

Dark background style sheet

FiveThirtyEight style sheet

FiveThirtyEight style sheet

Align labels and titles

Align labels and titles

Axes Demo

Axes Demo

Controlling view limits using margins and sticky_edges

Controlling view limits using margins and sticky_edges

Resize Axes with constrained layout

Resize Axes with constrained layout

Resize Axes with tight layout

Resize Axes with tight layout

Figure labels: suptitle, supxlabel, supylabel

Figure labels: suptitle, supxlabel, supylabel

Inverted axis

Inverted axis

Secondary Axis

Secondary Axis

Figure subfigures

Figure subfigures

Create multiple subplots using plt.subplots

Create multiple subplots using plt.subplots

Accented text

Accented text

Align y-labels

Align y-labels

Scale invariant angle label

Scale invariant angle label

Angle annotations on bracket arrows

Angle annotations on bracket arrows

Date tick labels

Date tick labels

Format ticks using engineering notation

Format ticks using engineering notation

Using ttf font files

Using ttf font files

Labelling subplots

Labelling subplots

Legend Demo

Legend Demo

Mathtext

Mathtext

Math fontfamily

Math fontfamily

Multiline

Multiline

Render math equations using TeX

Render math equations using TeX

Text properties

Text properties

Title positioning

Title positioning

Colorbar Tick Labelling

Colorbar Tick Labelling

Custom tick formatter for time series

Custom tick formatter for time series

Date precision and epochs

Date precision and epochs

Move x-axis tick labels to the top

Move x-axis tick labels to the top

Artist tests

Artist tests

Group barchart with units

Group barchart with units

Evans test

Evans test

Annotated cursor

Annotated cursor

Rectangle and ellipse selectors

Rectangle and ellipse selectors

Span Selector

Span Selector

Artist tutorial

Artist tutorial

Styling with cycler

Styling with cycler

Transformations Tutorial

Transformations Tutorial

Axis scales

Axis scales

Axis ticks

Axis ticks

Constrained layout guide

Constrained layout guide

Tight layout guide

Tight layout guide

Colormap normalization

Colormap normalization

Specifying colors

Specifying colors

Quick start guide

Quick start guide

Text in Matplotlib

Text in Matplotlib