matplotlib.figure.Figure.text#

Figure.text(x,y,s,fontdict=None,**kwargs)[source]#

Add text to figure.

Parameters:
x, yfloat

The position to place the text. By default, this is in figurecoordinates, floats in [0, 1]. The coordinate system can be changedusing thetransform keyword.

sstr

The text string.

fontdictdict, optional

A dictionary to override the default text properties. If not given,the defaults are determined byrcParams["font.*"]. Properties passed askwargs override the corresponding ones given infontdict.

Returns:
Text
Other Parameters:
**kwargsText properties

Other miscellaneous text parameters.

Property

Description

agg_filter

a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image

alpha

float or None

animated

bool

antialiased

bool

backgroundcolor

color

bbox

dict with properties forpatches.FancyBboxPatch

clip_box

unknown

clip_on

unknown

clip_path

unknown

color orc

color

figure

Figure orSubFigure

fontfamily orfamily orfontname

{FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}

fontproperties orfont orfont_properties

font_manager.FontProperties orstr orpathlib.Path

fontsize orsize

float or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}

fontstretch orstretch

{a numeric value in range 0-1000, 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'}

fontstyle orstyle

{'normal', 'italic', 'oblique'}

fontvariant orvariant

{'normal', 'small-caps'}

fontweight orweight

{a numeric value in range 0-1000, 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'}

gid

str

horizontalalignment orha

{'left', 'center', 'right'}

in_layout

bool

label

object

linespacing

float (multiple of font size)

math_fontfamily

str

mouseover

bool

multialignment orma

{'left', 'right', 'center'}

parse_math

bool

path_effects

list ofAbstractPathEffect

picker

None or bool or float or callable

position

(float, float)

rasterized

bool

rotation

float or {'vertical', 'horizontal'}

rotation_mode

{None, 'default', 'anchor'}

sketch_params

(scale: float, length: float, randomness: float)

snap

bool or None

text

object

transform

Transform

transform_rotates_text

bool

url

str

usetex

bool, default:rcParams["text.usetex"] (default:False)

verticalalignment orva

{'baseline', 'bottom', 'center', 'center_baseline', 'top'}

visible

bool

wrap

bool

x

float

y

float

zorder

float

Examples usingmatplotlib.figure.Figure.text#

Colormap reference

Colormap reference

Drawing fancy boxes

Drawing fancy boxes

Integral as the area under a curve

Integral as the area under a curve

XKCD

XKCD

Radar chart (aka spider or star chart)

Radar chart (aka spider or star chart)

Boxplots

Boxplots

Custom Figure subclasses

Custom Figure subclasses

The difference between \dfrac and \frac

The difference between \dfrac and \frac

Fonts demo (object-oriented style)

Fonts demo (object-oriented style)

Fonts demo (keyword arguments)

Fonts demo (keyword arguments)

Convert texts to images

Convert texts to images

STIX Fonts

STIX Fonts

Unicode minus

Unicode minus

Usetex font effects

Usetex font effects

Text watermark

Text watermark

Menu

Menu

Path effects guide

Path effects guide

Choosing Colormaps in Matplotlib

Choosing Colormaps in Matplotlib

Writing mathematical expressions

Writing mathematical expressions