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#

Markevery Demo

Markevery Demo

Multicolored lines

Multicolored lines

Grouped bar chart with labels

Grouped bar chart with labels

Bar chart with labels

Bar chart with labels

Stacked bar chart

Stacked bar chart

Bar chart with individual bar colors

Bar chart with individual bar colors

Hat graph

Hat graph

Horizontal bar chart

Horizontal bar chart

Broken horizontal bars

Broken horizontal bars

Scatter Demo2

Scatter Demo2

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

Stackplots and streamgraphs

Stackplots and streamgraphs

EventCollection Demo

EventCollection Demo

hlines and vlines

hlines and vlines

Many ways to plot images

Many ways to plot images

Image with masked values

Image with masked values

Image resampling

Image resampling

Interpolations for imshow

Interpolations for imshow

pcolor images

pcolor images

pcolormesh

pcolormesh

pcolormesh grids and shading

pcolormesh grids and shading

Image nonuniform

Image nonuniform

Triplot Demo

Triplot Demo

Tripcolor Demo

Tripcolor Demo

Tricontour Demo

Tricontour Demo

Tricontour Smooth User

Tricontour Smooth User

Tricontour Smooth Delaunay

Tricontour Smooth Delaunay

Trigradient Demo

Trigradient Demo

Contour plot of irregularly spaced data

Contour plot of irregularly spaced data

Contour Demo

Contour Demo

Contour Label Demo

Contour Label Demo

Contourf demo

Contourf demo

Contour corner mask

Contour corner mask

Advanced quiver and quiverkey functions

Advanced quiver and quiverkey functions

Interactive adjustment of colormap range

Interactive adjustment of colormap range

Annotated heatmap

Annotated heatmap

Different ways of specifying error bars

Different ways of specifying error bars

Errorbar subsampling

Errorbar subsampling

Including upper and lower limits in error bars

Including upper and lower limits in error bars

Plot a confidence ellipse of a two-dimensional dataset

Plot a confidence ellipse of a two-dimensional dataset

Histogram bins, density, and weight

Histogram bins, density, and weight

The histogram (hist) function with multiple data sets

The histogram (hist) function with multiple data sets

Hexagonal binned plot

Hexagonal binned plot

Violin plot customization

Violin plot customization

Cross- and auto-correlation

Cross- and auto-correlation

Power spectral density (PSD)

Power spectral density (PSD)

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

Create multiple subplots using plt.subplots

Create multiple subplots using plt.subplots

Axes Demo

Axes Demo

Resize Axes with constrained layout

Resize Axes with constrained layout

Resize Axes with tight layout

Resize Axes with tight layout

Controlling view limits using margins and sticky_edges

Controlling view limits using margins and sticky_edges

Figure subfigures

Figure subfigures

Inverted axis

Inverted axis

Twin Axes with delta_zorder

Twin Axes with delta_zorder

Secondary Axis

Secondary Axis

Align labels and titles

Align labels and titles

Figure labels: suptitle, supxlabel, supylabel

Figure labels: suptitle, supxlabel, supylabel

Format ticks using engineering notation

Format ticks using engineering notation

Date tick labels

Date tick labels

Custom tick formatter for time series

Custom tick formatter for time series

Date precision and epochs

Date precision and epochs

Colorbar Tick labelling

Colorbar Tick labelling

Asinh scale

Asinh scale

Loglog aspect

Loglog aspect

Log scale

Log scale

Exploring normalizations

Exploring normalizations

Symlog scale

Symlog scale

Spines

Spines

Spine placement

Spine placement

Text properties

Text properties

Multiline text

Multiline text

Angle annotations on bracket arrows

Angle annotations on bracket arrows

Labelling subplots

Labelling subplots

Scale invariant angle label

Scale invariant angle label

Legend Demo

Legend Demo

Accented text

Accented text

Using ttf font files

Using ttf font files

Mathtext

Mathtext

Math fontfamily

Math fontfamily

Render math equations using TeX

Render math equations using TeX

Title positioning

Title positioning

Line, Poly and RegularPoly Collection

Line, Poly and RegularPoly Collection

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

Color Demo

Color Demo

Colors in the default property cycle

Colors in the default property cycle

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

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

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

Make room for ylabel using axes_grid

Make room for ylabel using axes_grid

Axis Direction

Axis Direction

pyplot animation

pyplot animation

Annotated cursor

Annotated cursor

Radio Buttons Grid

Radio Buttons Grid

Rectangle and ellipse selectors

Rectangle and ellipse selectors

Span Selector

Span Selector

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

Artist tests

Artist tests

Group barchart with units

Group barchart with units

Evans test

Evans test

Packed-bubble chart

Packed-bubble chart

Rasterization for vector graphics

Rasterization for vector graphics

Zorder Demo

Zorder Demo

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

Artist tutorial

Artist tutorial

Coding shortcuts

Coding shortcuts

Quick start guide

Quick start guide

Styling with cycler

Styling with cycler

Transformations Tutorial

Transformations Tutorial

Axis autoscaling

Axis autoscaling

Axis scales

Axis scales

Axis ticks

Axis ticks

Placing colorbars

Placing colorbars

Constrained layout guide

Constrained layout guide

Tight layout guide

Tight layout guide

Colormap normalization

Colormap normalization

Specifying colors

Specifying colors

Text in Matplotlib

Text in Matplotlib