MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / text

Method text

lib/matplotlib/figure.py:1152–1199  ·  view source on GitHub ↗

Add text to figure. Parameters ---------- x, y : float The position to place the text. By default, this is in figure coordinates, floats in [0, 1]. The coordinate system can be changed using the *transform* keyword. s : s

(self, x, y, s, fontdict=None, **kwargs)

Source from the content-addressed store, hash-verified

1150
1151 @_docstring.interpd
1152 def text(self, x, y, s, fontdict=None, **kwargs):
1153 """
1154 Add text to figure.
1155
1156 Parameters
1157 ----------
1158 x, y : float
1159 The position to place the text. By default, this is in figure
1160 coordinates, floats in [0, 1]. The coordinate system can be changed
1161 using the *transform* keyword.
1162
1163 s : str
1164 The text string.
1165
1166 fontdict : dict, optional
1167 A dictionary to override the default text properties. If not given,
1168 the defaults are determined by :rc:`font.*`. Properties passed as
1169 *kwargs* override the corresponding ones given in *fontdict*.
1170
1171 Returns
1172 -------
1173 `~.text.Text`
1174
1175 Other Parameters
1176 ----------------
1177 **kwargs : `~matplotlib.text.Text` properties
1178 Other miscellaneous text parameters.
1179
1180 %(Text:kwdoc)s
1181
1182 See Also
1183 --------
1184 .Axes.text
1185 .pyplot.text
1186 """
1187 effective_kwargs = {
1188 'transform': self.transSubfigure,
1189 **(fontdict if fontdict is not None else {}),
1190 **kwargs,
1191 }
1192 text = Text(x=x, y=y, text=s, **effective_kwargs)
1193 text.set_figure(self)
1194 text.stale_callback = _stale_figure_callback
1195
1196 self.texts.append(text)
1197 text._remove_method = self.texts.remove
1198 self.stale = True
1199 return text
1200
1201 @_docstring.interpd
1202 def colorbar(

Callers 1

_suplabelsMethod · 0.95

Calls 2

TextClass · 0.90
set_figureMethod · 0.45

Tested by

no test coverage detected