text_wrapper(self, func, x=0, y=0, text='', transform='data', family=None, fontfamily=None, fontname=None, fontsize=None, size=None, border=False, bordercolor='w', borderwidth=2, borderinvert=False, **kwargs)[source]

Enables specifying tranform with a string name and adds a feature for drawing borders around text.


This function wraps text

  • x, y (float) – The x and y coordinates for the text.

  • text (str) – The text string.

  • transform ({‘data’, ‘axes’, ‘figure’} or Transform, optional) – The transform used to interpret x and y. Can be a Transform object or a string representing the transData, transAxes, or transFigure transforms. Default is 'data', i.e. the text is positioned in data coordinates.

  • fontsize, size (float or str, optional) – The font size. If float, units are inches. If string, units are interpreted by units.

  • fontname, fontfamily, family (str, optional) – The font name (e.g. 'Fira Math') or font family name (e.g. 'serif'). Matplotlib falls back to the system default if not found.

  • fontweight, weight, fontstyle, style, fontvariant, variant (str, optional) – Additional font properties. See Text for details.

  • border (bool, optional) – Whether to draw border around text.

  • borderwidth (float, optional) – The width of the text border. Default is 2 points.

  • bordercolor (color-spec, optional) – The color of the text border. Default is 'w'.

  • borderinvert (bool, optional) – If True, the text and border colors are swapped.

Other Parameters

**kwargs – Passed to text.