
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/units/radian_demo.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. meta::
        :keywords: codex

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

        :ref:`Go to the end <sphx_glr_download_gallery_units_radian_demo.py>`
        to download the full example code.

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

.. _sphx_glr_gallery_units_radian_demo.py:


============
Radian ticks
============

Plot with radians from the basic_units mockup example package.


This example shows how the unit class can determine the tick locating,
formatting and axis labeling.

.. only:: builder_html

   This example requires :download:`basic_units.py <basic_units.py>`

.. GENERATED FROM PYTHON SOURCE LINES 16-31



.. image-sg:: /gallery/units/images/sphx_glr_radian_demo_001.png
   :alt: radian demo
   :srcset: /gallery/units/images/sphx_glr_radian_demo_001.png, /gallery/units/images/sphx_glr_radian_demo_001_2_00x.png 2.00x
   :class: sphx-glr-single-img





.. code-block:: Python


    from basic_units import cos, degrees, radians

    import matplotlib.pyplot as plt
    import numpy as np

    x = [radians * val for val in np.arange(0, 15, 0.01)]

    fig, axs = plt.subplots(2)

    axs[0].plot(x, cos(x), xunits=radians)
    axs[1].plot(x, cos(x), xunits=degrees)

    fig.tight_layout()
    plt.show()


.. _sphx_glr_download_gallery_units_radian_demo.py:

.. only:: html

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

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

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

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

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

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: radian_demo.zip <radian_demo.zip>`


.. only:: html

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

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