
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "auto_examples\matplotlib\transf_math.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        Click :ref:`here <sphx_glr_download_auto_examples_matplotlib_transf_math.py>`
        to download the full example code

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_auto_examples_matplotlib_transf_math.py:


transformation math
===================

.. GENERATED FROM PYTHON SOURCE LINES 5-27



.. image-sg:: /auto_examples/matplotlib/images/sphx_glr_transf_math_001.png
   :alt: transf math
   :srcset: /auto_examples/matplotlib/images/sphx_glr_transf_math_001.png
   :class: sphx-glr-single-img





.. code-block:: default

    from pylab import *
    from matplotlib import lines
    from matplotlib.transforms import IdentityTransform
    fig, (ax1,ax2) = subplots(2,1, figsize=(4,4))
    subplots_adjust(left=0.2)
    x1,y1 = ax1.transAxes.transform(r_[0,1])
    x2,y2 = ax2.transAxes.transform(r_[0,0])
    x1-=40
    x_text = x1-10
    x2-=40
    x1,y1 = fig.transFigure.inverted().transform(r_[x1,y1])
    x_text,_ = fig.transFigure.inverted().transform(r_[x_text,0])
    x2,y2 = fig.transFigure.inverted().transform(r_[x2,y2])
    lineA = lines.Line2D([x1,x2],[y1,y2],
            linewidth=3, color='r', transform=fig.transFigure,
            clip_on=False)
    lineB = lines.Line2D([0,1],[0,1], linewidth=3, color='b', transform=ax1.transAxes,
            clip_on=False)
    text(x_text, 0.5, "a label", va='center', ha='right', rotation=90, transform=fig.transFigure, color='r')
    ax1.add_line(lineA)
    ax1.add_line(lineB)
    show()


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** ( 0 minutes  0.058 seconds)


.. _sphx_glr_download_auto_examples_matplotlib_transf_math.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example


    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: transf_math.py <transf_math.py>`

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: transf_math.ipynb <transf_math.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
