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#

Bar color demo

Bar color demo

Bar Label Demo

Bar Label Demo

Stacked bar chart

Stacked bar chart

Grouped bar chart with labels

Grouped bar chart with labels

Horizontal bar chart

Horizontal bar chart

Errorbar subsampling

Errorbar subsampling

EventCollection Demo

EventCollection Demo

Fill Between and Alpha

Fill Between and Alpha

Filling the area between lines

Filling the area between lines

Fill Betweenx Demo

Fill Betweenx Demo

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

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

Creating annotated heatmaps

Creating annotated heatmaps

Image antialiasing

Image antialiasing

Many ways to plot images

Many ways to plot images

Image Masked

Image Masked

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

Aligning Labels and Titles

Aligning Labels and Titles

Axes Demo

Axes Demo

Controlling view limits using margins and sticky_edges

Controlling view limits using margins and sticky_edges

Resizing Axes with constrained layout

Resizing Axes with constrained layout

Resizing Axes with tight layout

Resizing 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

Creating multiple subplots using plt.subplots

Creating multiple subplots using plt.subplots

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

Bar of pie

Bar of pie

Labeling a pie and a donut

Labeling a pie and a donut

Polar plot

Polar plot

Error bar rendering on polar axis

Error bar rendering on polar axis

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

Labeling ticks using engineering notation

Labeling 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

Rendering math equations using TeX

Rendering math equations using TeX

Text Commands

Text Commands

Title positioning

Title positioning

Color Demo

Color Demo

Creating a colormap from a list of colors

Creating a colormap from a list of colors

Ways to set a color's alpha value

Ways to set a color's alpha value

Line, Poly and RegularPoly Collection with autoscaling

Line, Poly and RegularPoly Collection with autoscaling

Compound path

Compound path

Mmh Donuts!!!

Mmh Donuts!!!

Plotting multiple lines with a LineCollection

Plotting multiple lines with a LineCollection

Bezier Curve

Bezier Curve

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

Make room for ylabel using axes_grid

Make room for ylabel using axes_grid

Axis Direction

Axis Direction

Anatomy of a figure

Anatomy of a figure

XKCD

XKCD

pyplot animation

pyplot animation

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

Poly Editor

Poly Editor

Trifinder Event Demo

Trifinder Event Demo

Viewlims

Viewlims

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

Asinh Demo

Asinh Demo

Loglog Aspect

Loglog Aspect

Exploring normalizations

Exploring normalizations

Scales

Scales

Radar chart (aka spider or star chart)

Radar chart (aka spider or star chart)

Topographic hillshading

Topographic hillshading

Spines

Spines

Spine placement

Spine placement

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

Quick start guide

Quick start guide

Styling with cycler

Styling with cycler

Transformations Tutorial

Transformations Tutorial

Constrained layout guide

Constrained layout guide

Tight layout guide

Tight layout guide

Axis scales

Axis scales

Axis ticks

Axis ticks

Specifying colors

Specifying colors

Colormap normalization

Colormap normalization

Text in Matplotlib

Text in Matplotlib