{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Annotation with units\n\nThe example illustrates how to create text and arrow\nannotations using a centimeter-scale plot.\n\n.. only:: builder_html\n\n   This example requires :download:`basic_units.py <basic_units.py>`\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "from basic_units import cm\n\nimport matplotlib.pyplot as plt\n\nfig, ax = plt.subplots()\n\nax.annotate(\"Note 01\", [0.5*cm, 0.5*cm])\n\n# xy and text both unitized\nax.annotate('local max', xy=(3*cm, 1*cm), xycoords='data',\n            xytext=(0.8*cm, 0.95*cm), textcoords='data',\n            arrowprops=dict(facecolor='black', shrink=0.05),\n            horizontalalignment='right', verticalalignment='top')\n\n# mixing units w/ nonunits\nax.annotate('local max', xy=(3*cm, 1*cm), xycoords='data',\n            xytext=(0.8, 0.95), textcoords='axes fraction',\n            arrowprops=dict(facecolor='black', shrink=0.05),\n            horizontalalignment='right', verticalalignment='top')\n\n\nax.set_xlim(0*cm, 4*cm)\nax.set_ylim(0*cm, 4*cm)\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.6"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}