Axes.text

Axes.text(*args, border=False, bbox=False, bordercolor='w', borderwidth=2, borderinvert=False, borderstyle='miter', bboxcolor='w', bboxstyle='round', bboxalpha=0.5, bboxpad=None, **kwargs)[source]

Add text to the axes.

Parameters
  • x, y, [z] (float) – The coordinates for the text. ThreeAxes accept an optional third coordinate. If only two are provided this automatically redirects to the text2D method.

  • s, text (str) – The string for the text.

  • transform ({'data', 'axes', 'figure'} or Transform, optional) – The transform used to interpret the bounds. Can be a Transform instance or a string representing the transData, transAxes, or transFigure transforms. Default is 'axes', i.e. bounds is in axes-relative coordinates.

Other Parameters
  • 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.

  • borderstyle ({'miter', 'round', 'bevel'}, optional) – The line join style used for the border.

  • bbox (bool, optional) – Whether to draw a bounding box around text.

  • bboxcolor (color-spec, optional) – The color of the text bounding box. Default is 'w'.

  • bboxstyle (boxstyle, optional) – The style of the bounding box. Default is 'round'.

  • bboxalpha (float, optional) – The alpha for the bounding box. Default is 0.5.

  • bboxpad (float, optional) – The padding for the bounding box. Default is rc['title.bboxpad'] = None.

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

  • size, fontsize (unit-spec or str, optional) – The font size. If float, units are points. If string, interpreted by units. This can also be a string indicating some scaling relative to rc['font.size']. The sizes and scalings are shown below. The scalings 'med', 'med-small', and 'med-large' are added by proplot while the rest are native matplotlib sizes.

    Size

    Scale

    'xx-small'

    0.579

    'x-small'

    0.694

    'small', 'smaller'

    0.833

    'med-small'

    0.9

    'med', 'medium'

    1.0

    'med-large'

    1.1

    'large', 'larger'

    1.2

    'x-large'

    1.440

    'xx-large'

    1.728

    'larger'

    1.2

  • **kwargs – Passed to matplotlib.axes.Axes.text.