{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Concatenate text objects with different properties\n\nThe example strings together several Text objects with different properties\n(e.g., color or font), positioning each one after the other.  The first Text\nis created directly using `~.Axes.text`; all subsequent ones are created with\n`~.Axes.annotate`, which allows positioning the Text's lower left corner at the\nlower right corner (``xy=(1, 0)``) of the previous one (``xycoords=text``).\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\n\nplt.rcParams[\"font.size\"] = 20\nax = plt.figure().add_subplot(xticks=[], yticks=[])\n\n# The first word, created with text().\ntext = ax.text(.1, .5, \"Matplotlib\", color=\"red\")\n# Subsequent words, positioned with annotate(), relative to the preceding one.\ntext = ax.annotate(\n    \" says,\", xycoords=text, xy=(1, 0), verticalalignment=\"bottom\",\n    color=\"gold\", weight=\"bold\")  # custom properties\ntext = ax.annotate(\n    \" hello\", xycoords=text, xy=(1, 0), verticalalignment=\"bottom\",\n    color=\"green\", style=\"italic\")  # custom properties\ntext = ax.annotate(\n    \" world!\", xycoords=text, xy=(1, 0), verticalalignment=\"bottom\",\n    color=\"blue\", family=\"serif\")  # custom properties\n\nplt.show()"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.14.7"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}